# How to calculate the probability of a random variable in a normal distribution in Python

A normal distribution is a probability distribution based on a mean and standard deviation that is commonly seen in statistics. The probability distribution function or PDF computes the likelihood of a single point in the distribution and the cumulative distribution function or CDF computes the likelihood of an interval of the distribution.

Solution for How to calculate the probability of a random variable in a normal distribution in Python : You can use scipy.stats.norm to compute a PDF or CDF in Python To find the PDF for a number x, call scipy.stats.norm.pdf(x, loc=None, scale=None) with loc set to the mean and scale to the standard deviation. To find the CDF for an interval from x to y, subtract scipy.stats.norm.cdf(x, loc=None, scale=None) from scipy.stats.norm.cdf(y, loc=None, scale=None) with loc set to the mean and scale to the standard deviation.

If the loc and scale values are not set, they will default to 0 and 1.