I'm making a program and it needs a while loop to repeat a process. I don't really understand while loops, and the demonstrations online don't really help with my situation.
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 (""))
What I understand is, you want to prompt for entering password until input/password is 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. ")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.