-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLottery.py
More file actions
28 lines (28 loc) · 728 Bytes
/
Copy pathLottery.py
File metadata and controls
28 lines (28 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import random
ticketshas = []
for i in range(50):
ticket = random.randint(1,random.randint(1,100))
if ticket not in ticketshas:
ticketshas.insert(0,ticket)
print(ticketshas)
not_in_box = True
while not_in_box:
guess = input("enter your loto number\n> ")
guess = int(guess)
if guess in ticketshas:
print("number already selected")
else:
print("number is now in the box")
ticketshas.insert(0,guess)
not_in_box = False
winner = str(random.choice(ticketshas))
print("-------------------")
print("--- the lottery ---")
print("-------------------\n")
print("\n the results are in...")
print("the winner is number " + winner)
winner = int(winner)
if guess == winner:
print("you won!")
else:
print("you did not win")