Employ a Python program to ask the user to enter the mean and variance of the distribution. Tell the user that the mean can be any value between minus infinity (–∞) and plus infinity (+∞), but the variance must be a value larger than 0. Integrate certain control mechanism to ensure that the variance condition is fulfilled, and the input is numeric. If the user press ENTER without providing any values, the program will automatically set μ to 0 and σ2 to 1.
while True:
mean = int(input("please enter the mean of the distribution (any value between –∞ and +∞) "))
variance = int(input("please enter the variance of the distribution (must be larger than 0) "))
if variance >= 0:
mean = (float(mean))
variance = (float(variance))
print(mean)
print(variance)
elif variance == int(""):
mean = 0.0
variance = 1.0
print(variance)
else:
print("Variance input is smaller than zero")
break