+ 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

5th Oct 2023, 12:41 PM
Sam Buzhduga
Sam Buzhduga - avatar
5 Answers
+ 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)
5th Oct 2023, 12:59 PM
Aaron Lee
Aaron Lee - avatar
+ 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.
5th Oct 2023, 7:19 PM
Lothar
Lothar - avatar
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.)
5th Oct 2023, 11:50 PM
Annihilate
Annihilate - avatar
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.")
5th Oct 2023, 11:53 PM
Annihilate
Annihilate - avatar
0
password = "CheesePuff" guess = input() while guess != password: guess = input() print("Access Granted")
6th Oct 2023, 1:36 PM
Sina Ghorbanian
Sina Ghorbanian - avatar