-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprogram1.py
More file actions
25 lines (20 loc) · 837 Bytes
/
Copy pathprogram1.py
File metadata and controls
25 lines (20 loc) · 837 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
import random
def lotteryf():
tryagain= "yes"
while tryagain[0]=='y':
first= random.randint(0,9)
second=random.randint(0,9)
third=random.randint(0,9)
randoms= [first, second, third]
numb1= int(input('\nEnter 1st number(0-9): '))
numb2= int(input('Enter 2nd number(0-9): '))
numb3= int(input('Enter 3rd number(0-9): '))
if numb1 in randoms and numb2 in randoms and numb3 in randoms :
print("\nYou Win! Congratulation")
print(f"The winning numbers are {randoms}.")
tryagain= input("Want to play again? (y or n): ")
else:
print ('\nYou lose')
print(f"The winning numbers are {randoms}.")
tryagain= input("Try Again? (y or n): ")
lottery= lotteryf()