# Coin toss experiment using Python

Checking if tossing a fair coin n times leads to probability of heads converging to 1/2, when n is very large(tends to infinity) using python. The program depicts the strong law of large numbers

## Probability of getting heads while tossing a fair coin

### In day-to-day life, we expect the probability of heads in a toss of fair coin will always be 1/2. But this may not be the case in the actual world.

Sometimes the value of n i.e. number of times the coin is tossed may be too small to get the accurate idea of the value of probability of heads while tossing a fair coin, but when we increase the value of n (as n tends to infinity), it can be observed that the value of probability of heads in the actual world tends to that of the theoretical world i.e. 1/2. This is a proof of the strong law of large numbers. This law states that the actual probability of an experiment tends to its theoretical probability for example tossing of a fair coin, getting a six in a roll of die.

#### We are performing a coin toss experiment to depict strong law of large numbers using python programming language.

To prove the above statement we can use the following steps:

1. First we will import the library random in python which we basically use to generate random numbers

2. We will generate 0's and 1's and assign those numbers to the variable toss

3. We assign the value 1 to heads and 0 to tails

4. Then we ask the user to input N i.e. the number of times the coin is tossed

5. When the value of N is too small the prabability of heads is not usually 0.5 (theoretical probability), when we increase the value of N the probability of heads converges to 0.5

6. This python program depicts the strong law of large numbers.