Skip to content
C

Problem 1: Coin Flip Simulator

Easypython

Problem Description

Write a Python program that simulates flipping a fair coin a given number of times, and prints the estimated probability of getting heads.

Input

An integer representing the number of coin flips to simulate.

Output

The estimated probability of heads, based on the simulation.

Constraints

  • Number of flips will be a positive integer (at least 100 recommended for a stable estimate).

Example Input

text
1000

Example Output

text
Estimated probability of heads: 0.49

Concepts Covered

random module, simulation-based probability estimation, loops.

Input (stdin)

Output

Run your code to see output here...