-
Notifications
You must be signed in to change notification settings - Fork 27
/
projectLottery.py
44 lines (37 loc) · 1.14 KB
/
projectLottery.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#IMPORT RANDOM MODULE
import random
#CREATE VARIABLE
user_list = []
random_list = []
user_value = 0
random_value = 0
count = 0
matches = 0
#GET VALUES FROM THE USER INTO A LIST
user_list.append(int(input("Insert number 1 : ")))
user_list.append(int(input("Insert number 2 : ")))
user_list.append(int(input("Insert number 3 : ")))
user_list.append(int(input("Insert number 4 : ")))
user_list.append(int(input("Insert number 5 : ")))
print("\n")
#GET RANDOM NUMBERS INTO A LIST
random_list.append(random.randrange(1,50))
random_list.append(random.randrange(1,50))
random_list.append(random.randrange(1,50))
random_list.append(random.randrange(1,50))
random_list.append(random.randrange(1,50))
#DISPLAY THE USER ENTRIES
print("User number :",end = " ")
for user_value in user_list:
print(user_value,end = " ")
print("\n")
#DISPLAY THE LOTTERY NUMBERS
print("Lottery numbers : ",end = " ")
for random_value in random_list:
print(random_value,end = " " )
#LOOK FOR MATCHING VALUES IN BOTH LISTS
for count in range (5):
if user_list[count] == random_list[count]:
matches +=1
#DISPLAY NUMBER OF MATCHES
print("\n\nYou have",matches,"matches")