Hello and sorry if this was already asked. I'm trying to program a simple lottery simulation (for learning propose) Some how my if statement doesn't trigger so no matter what the user enters, the program uses the else statement. I try to work around it by simply seperating them into 2 if statements, but it still doesn't work.
Thank you very much for your time and help guys!
Here is the code:
import random
lottonumbers = []
lottonumbers = list(range(1,51))
lottonumbersro = random.sample(lottonumbers, 6) #right ones
print(lottonumbersro)
active = True
while active:
userinput = input('your numbers')
if userinput == lottonumbersro:
print('you won', lottonumbersro)
active = False
break
if userinput != lottonumbersro:
print('no luck today', lottonumbersro)
active = False
break
print('why isn\'t this shit working')
Aucun commentaire:
Enregistrer un commentaire