import math
import matplotlib.pyplot as plt
import numpy as np

def z_score_to_prob(z_score):
    return 0.5 * (1 + math.erf(z_score / math.sqrt(2)))

def plot_normal_distribution(z_score):
    x_min = -4
    x_max = 4
    x = np.arange(x_min, x_max, 0.01)
    y = z_score_to_prob((x - 0) / 1)

    fig, ax = plt.subplots()
    ax.plot(x, y)
    ax.axvline(z_score, color='red', linestyle='--')
    ax.text(z_score + 0.3, 0.05, f"z = {z_score:.2f}", color='red')
    plt.show()

z_score = float(input("Enter a z-score: "))
prob = z_score_to_prob(z_score)
print("The probability of a standard normal distribution being less than", z_score, "is approximately", prob)
print()
plot_normal_distribution(z_score)
