Expected count from a probability simulation

A student simulates a basketball player who makes 35% of free throws. The program below runs 400 simulated attempts:


Python
import random

made = 0
for attempt in range(400):
    if random.random() < 0.35:
        made += 1
print(made)


The printed number changes from run to run. On average over many runs, what value is printed? Give your answer as a whole number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More The random Module Questions: