为什么这个程序在三次密码猜测后都没有停止?

时间:2015-05-11 15:54:30

标签: python

username = "Patrick"

password = "Kearney"



username = input("Username:")

while username != "Patrick":

    print("Please try again.")

    username = input("Enter your username again.")


password = input("Password:")

incorrect = 0

threshold = 3

while password != "Kearney":

        print("Please try again.")

        password = input("Enter your password again.")

if password != "Kearney":

        incorrect += 1
else:
        print("Welcome Patrick")
        incorrect = 0


if incorrect == threshold:

        import sys

        sys.exit()

0 个答案:

没有答案