我正在制作一个程序,它需要一个while循环来重复一个过程。我不太了解while循环,在线演示对我的情况没有帮助。
while true:
if password == 1526:
typewriter ("ACCESS GRANTED")
else:
typewriter ("ACCESS DENIED")
typewriter ("You must enter the password correctly to proceed. ")
typewriter ("Please input password: ")
password = int(input (""))
答案 0 :(得分:2)
据我所知,您希望在输入/密码为1256之前提示输入密码。
while True:
typewriter("Please input password: ")
password = int(input (""))
if password == 1526:
typewriter ("ACCESS GRANTED")
break
else:
typewriter ("ACCESS DENIED")
typewriter ("You must enter the password correctly to proceed. ")