Lottery stimulation of average human life using Python

How many of you have played the lottery game in your lifespan? For those who don’t know what it is:- “Lottery is a means of raising money by selling numbered tickets and giving prizes to the holders of numbers drawn at random.” according to Oxford dictionary.

Do you consider it a good practice? Had it ever happened that you were stopped by your parents or your known ones to not play the game?
This happens with generally all of us. But almost all of us don’t realize it.
How a game where there is always a chance of winning more then you invest can be proved to be wrong?

What if I tell you that you will lose more than you can get? Probably, you will not believe me at first. You are most likely to say that wait, it is a game of chance. If your destiny is not with you then only you will lose.
Also, you can always try one more time if you lose that amount. You will surely win then.

Okay, now you may be against me thinking that I am saying useless stuff. You all have heard that from your elders(in my case) or others.
What if I can prove it?

You might not believe me but you will believe on computers. Right?
So, let’s visualize it using Programming.

Contents

Lottery Simulation in Python

```# -*- coding: utf-8 -*-
"""
Created on Tue Apr 1 15:55:25 2020

@author: Kapil Bansal
"""

import random #To get unbiased situations
import matplotlib.pyplot as plt  #To visualize the pattern

account=0   #Assuming you had earned rupees 0 till now from the lottery in you account
x=[]
y=[]
#Here I am assuming that you will invest in a lottery for your whole life. The life expectancy of a human is 72 years(approx)
for i in range(3744): #Assuming you play lottery weekly 72years*52 weeks/year * 1 lottery/week =3744 lotteries
x.append(i+1)
bet=random.randint(1,10) #The number on which you bet
lucky=random.randint(1,10) #The number on the winning ticket.

if(bet==lucky):
account=account+1000-100
else:
account=account-100
y.append(account)
print(account)
p=plt.plot([x],[y],'ro',linewidth=0.01)
```

Here it is assumed that there are 10 tickets in the lottery and cost of buying a ticket is Rs 100 and winning amount each time is rupees 1000.

You can try making different graphs by changing above assumptions.

Here you might be thinking that if your winning probability is 1/10 i.e.,10% then why you loose such a big amount of money.The truth lies in the fact that the probabilities are independent, i.e.,your current win or lose will not be decided by the past events.