I've used the below code but I can't get the output.
from scipy.stats import norm
prob = norm.pdf(0.5, m, s)
import sys
sys.stdin.readline()
print(sys.stdinreadin())
def input:
print("Enter any value")
I need to find the probability ( prob
) when I input a number. Any suggestions?
Well, you could write something simple like:
from scipy.stats import norm
mean = int(input("Give me the mean: "))
std_dev = int(input("Give me the standard deviation: "))
prob = norm.pdf(0.5, mean, std_dev)
print(prob)
There are other ways to do this, like creating a function, but without knowing what you want to do exactly, it's hard to know - except that you want to get the probability. Nonetheless, this should do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.