+ 1
In this coding for passwords when you give the wrong input it supposed to ask you to input again but it doesn't How do I fix it?
This code is based off of the the "Introduction to Python" lesson: "More on Iteration". https://code.sololearn.com/cg4WxzxxdrMb/?ref=app
5 Réponses
+ 8
Sololearn doesn't have an interactive console. So any input your program needs is collected at the first prompt for input. It will not prompt again in the middle of running your program. So if there are multiple inputs or, in your case, a continuous prompting for input, if not all the input is entered at that first prompt, your program will not run as expected and/or end in an error (EOFError for Python)
+ 4
Sam Buzhduga ,
to test your code in an *interactive mode*, you can use e.g. replit.com. there are apps for mobile devices available and there is also a website.
0
The password should start blank, then it is reassigned as the user guesses until they guess it correctly.(according to a book I read.)
0
#sample code:
password = None
while password != "CheesePuff":
password = input()
if password != "CheesePuff":
print("Your password is incorrect.")
if password == null:
break
print("Correct password. Welcome.")
0
password = "CheesePuff"
guess = input()
while guess != password:
guess = input()
print("Access Granted")