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

Generating a sample

A hospital's planning department is investigating different treatments for newborns. As a data scientist you are hired to simulate the sex of 250 newborn children, and you are told that on average 50.50% are males.

Bu egzersiz

Foundations of Probability in Python

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

Egzersiz talimatları

  • Import the binom object from scipy.stats.
  • Generate a sample of 250 newborns with 50.50% probability of being male.
  • Print the sample.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import the binom object
from scipy.stats import ____

# Generate a sample of 250 newborn children
sample = ____.____(n=____, p=____, size=____, random_state=42)

# Show the sample values
print(____)
Kodu Düzenle ve Çalıştır