ComeçarComece de graça

Bernoulli distribution

Let's start simple with the Bernoulli distribution. In this exercise, you'll generate sample data for a Bernoulli event and then examine the visualization produced. Before we start, make yourself familiar with the rvs() function within scipy.stats that we'll use for sampling over the next few exercises.

Let's stick to the prior example of flipping a fair coin and checking the outcome: heads or tails. Remember that matplotlib is already imported as plt for you.

Este exercício faz parte do curso

Practicing Statistics Interview Questions in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Generate bernoulli data
from scipy.stats import bernoulli
data = bernoulli.rvs(p=____, size=____)
Editar e executar o código