Python密码,三次尝试
我只是创建了一个密码验证过程。程序要求用户输入密码;他们有三次尝试。如果他们没有纠正,请让他们再试一次。它只是不能正常运行 如果我输入Tom作为密码,它将不会被授予访问权限。此外,在我尝试了两次尝试后,第三次尝试没有出现Python密码,三次尝试,python,Python,我只是创建了一个密码验证过程。程序要求用户输入密码;他们有三次尝试。如果他们没有纠正,请让他们再试一次。它只是不能正常运行 如果我输入Tom作为密码,它将不会被授予访问权限。此外,在我尝试了两次尝试后,第三次尝试没有出现 password = 'Tom' count = 0 while count <= 3: Question = input('Please enter the password: try1') if Question == password:
password = 'Tom'
count = 0
while count <= 3:
Question = input('Please enter the password: try1')
if Question == password:
print('Access granted Pass 1')
break
while count <= 2:
Question = input('That is incorrect, please try again: trytwo')
count += 2
while count <= 1 :
Question = input('That is incorrect, please try again: trythree')
else:
print('Access denied')
count += 1
在这种情况下,您不正确地使用while循环 密码='Tom' 计数=1 而计数