Interview Query

Density to Cumulative

2
Have you seen this question before?

Given a list pdf write a function to_cdf(pdf) to caluculate the cdf.

Example:

Input:

def to_cdf(pdf) 
      return(cdf) ->

#Input
pdf = [1.2,3.4,5.3]

Output:

#output 

cdf = [1.2,4.6,9.9]

Note: Round the numbers to 3 digits.

Next question: Move Zeros Back
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code