Back to Python Interview
Python Interview

Python Interview

15 of 30 Completed

Bernoulli Sample
Go to question details page

Write a function to get a sample from a Bernoulli trial.

Input:

def bernoulli_sample(p):
    pass

Output:

1 with probability p or 0 with probability 1-p.

Good job, keep it up!

50%

Completed

You have 15 sections remaining on this learning path.

Loading pricing options