mercredi 29 novembre 2017

Python, Program Assigning code to Random integer, and checking with user input not functioning

#test
import subprocess
import time
import random
programClass=[]
code=random.randint(100,1000)
print('This is your secret code! PLEASE WRITE THIS DOWN!')
print(code)
numRafflePeople=0

tester=1
while tester==1:
    code1=input('What is your name, phone number, and email?\n')
    print('code',code1)
    code=code
    if code==code1:
        print('Blah')
    time.sleep(5)
    tester=2
else:
    print('fail')
    tester=1

This program makes a random number, then checks to see if the inputed number is the same as the random number, however when I run the program the program does not seem to be able to identify they are the same...

The random number will be like 303 I will type 303, and the fail message will be printed, can someone please explain the error in my code?

Thanks in Advance!

Aucun commentaire:

Enregistrer un commentaire