Remix Library / Techy

Probability Lab

Roll dice 10,000 times, estimate π by throwing random darts, and see math turn into pictures.

Intermediate Python
No account needed: you’ll start as a guest.
read-only · remix to edit
Output

What you'll learn

  • Simulations
  • The random module
  • Counter & dictionaries
  • Text bar charts
  • Monte Carlo methods

Challenges

Remix it, then try these. Each one is a bit harder than the last.

  1. Roll three dice instead of two. What's the most common total now?
  2. Make ROLLS bigger. Does the estimate for π get closer?
  3. Simulate the birthday problem: how many people until two share a birthday?
  4. Simulate flipping a coin until you get 5 heads in a row. How long does it take on average?
  5. Draw the histogram sideways (vertical bars) instead.