BaşlayınÜcretsiz Başlayın

Using binom to flip even more coins

Previously, you simulated 10 coin flips with a 35% chance of getting heads using bernoulli.rvs().

This exercise loads the binom object from scipy.stats so you can use binom.rvs() to simulate 20 trials of 10 coin flips with a 35% chance of getting heads on each coin flip.

Bu egzersiz

Foundations of Probability in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the binom.rvs() function to simulate 20 trials of 10 coin flips with a 35% chance of getting heads.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Set the random seed to reproduce the results
np.random.seed(42)

# Simulate 20 trials of 10 coin flips 
draws = ____.rvs(n=____, p=____, size=____)
print(draws)
Kodu Düzenle ve Çalıştır