import random
password = random.randint(0,1000000)
guess = 0
c = 0
L = []
while len(L) <= 1000000 :
L.append(c)
c = c + 1
print(password)
def guesspassword():
a = input(*do you want to start tring to run the password now? press y to start or press y to change a password*)
global guess
global password
while guess != password:
print(guess)
b = random.randint(0,len(L))
guess = L[b]
L.pop(b)
else :
password = random.randint(0,1000000)
guesspassword()
guesspassword()
print (guess)
第一个while那里得到一个0-1000000的list要用掉不少时间,求一个更快的办法
password = random.randint(0,1000000)
guess = 0
c = 0
L = []
while len(L) <= 1000000 :
L.append(c)
c = c + 1
print(password)
def guesspassword():
a = input(*do you want to start tring to run the password now? press y to start or press y to change a password*)
global guess
global password
while guess != password:
print(guess)
b = random.randint(0,len(L))
guess = L[b]
L.pop(b)
else :
password = random.randint(0,1000000)
guesspassword()
guesspassword()
print (guess)
第一个while那里得到一个0-1000000的list要用掉不少时间,求一个更快的办法