Cumulative Distribution Function shows the probability that the random variable will attain a value equal to or less than each value that the random variable can take on.

The best example of continuous random variables is asset returns as the underlying variable can take any value.

Suppose, we have probabilities (say 0.20, 0.25, 0.30, 0.15 & 0.10) and want to calculate cumulative probability for the same. Probabilities can be defined using the ** List Function** as shown below-

`prob = [0.20, 0.25, 0.30, 0.15, 0.10]`

Now, we use a ** FOR LOOP Function** to add each element of the list to its previous cumulative probability (starts with 0) and print the cumulative probability at each value that the probability takes.

```
cumProb = 0
for eachProb in prob:
cumProb = cumProb + eachProb
print (cumProb)
```

User can also define a function to store this entire code instead of writing the code over and over again. Such function can be called upon with the updated probabilities as shown below-

```
def cumProbFunction():
cumProb = 0
for eachProb in prob:
cumProb = cumProb + eachProb
print (cumProb)
```

**Case - 01:** Probabilities are 0.20, 0.25, 0.30, 0.15 & 0.10

```
prob = [0.20, 0.25, 0.30, 0.15, 0.10]
cumProbFunction()
```

**Case - 02:** Probabilities are 0.10, 0.30, 0.25, 0.25 & 0.10

```
prob = [0.10, 0.30, 0.25, 0.25, 0.10]
cumProbFunction()
```

*Disclaimer:** We, in our example, only cover how to perform such functions and less focusing on the type of example we take. Our motive is to deliver the exact solution to the queries on "How To" in the most simplest way. Of course, the application of these function can be seen in our advanced modules with more complex examples and datasets.*

## Comments