lundi 19 janvier 2015

how to not repeat randint value

I just wrote a code to generate random numbers and try to match it with random numbers, but I don't know how to not repeat the randint value, can someone help me?



from random import randint
import time

first_time = time.ctime()
print first_time

x = randint(1, 10000)
while x != randint(1, 10000):
ran = randint(1, 10000)
print ran
x = ran

print 'You number is: ', x
print ('You stared at: '+first_time)
print ('You finished at: '+time.ctime())
print('Finish')




Aucun commentaire:

Enregistrer un commentaire