终止使用此密码检查程序

时间:2018-09-17 23:22:43

标签: python-3.x

编写此简单的python代码以检查密码。我正在尝试添加一个kill命令,但似乎无法弄清楚。

correct_password = "python123"
password = input("Enter Password: ")
while correct_password != password:
    password = input("Try again: ")
    if password = "q":
        exit()

1 个答案:

答案 0 :(得分:0)

您只需要使用=这样的符号 如果VARIABLE ==是

    correct_password = "python123"
password = input("Enter Password: ")
while correct_password != password:
    password = input("Try again: ")
    if password == "q":
        exit()

这是您的代码,没有错误。