There is something messed up. I don’t know what it is.
"""
In Finland, in lottery game, you select 7 numbers. In the lottery are 7 numbers randomly made up by machine
, these numbers are 1-37 inclusive, also 3 extra numbers are made up by machine.
The purpose of the program is that user makes a row and then computer does the lottery, the outcome is printed
at last.
"""
user_numbers = [0] * 38
x = 1
#input lottonumerot
while x < 8:
selected_numbers = input('Give a number ( 1-37 inclusive) ' + str(x) + ": ")
user_numbers[int(selected_numbers)] = 1
x = 1 + x
PCs_row = [0] * 38
x = 1 #PC does the lottery
while x < 8:
PC_numbers = random.randint(1,37)
if int(PCs_row[PC_numbers]) == 0:
PCs_row[int(PC_numbers)] = 1
x = x + 1
else:
continue
x = 1 #PC does the 3 extranumber lottery
while x < 4:
PC_numbers = random.randint(1,37)
if int(PCs_row[PC_numbers]) == 0:
PCs_row[int(PC_numbers)] = 2
x = x + 1
else:
continue
x = 1 #check numbers
matches = 0
while x < 38:
if int(PCs_row[x]) == 1 and int(user_numbers[x == 1]):
matches = matches + 1
x = x + 1
else:
x = x + 1
x = 1 #check extranumbers
matching_extras = 0
while x < 38:
if (int(PCs_row[x]) == 1 or int(PCs_row[x]) == 2) and (int(user_numbers[x] == 2)):
matching_extras = matching_extras + 1
x = x + 1
else:
x = x + 1
print("matches " + matches)