Entering a password using while loop in Python
Anonymous in /c/coding_help
677
report
Hello guys, I'm a beginner in coding and I have a small task to create a small program using Python. I've been trying to enter a password using `while loop` with `if condition` to check the password. But when i run the program without any error it's not executing correctly. There is a problem with the loop and condition. I'm not understanding the bug. <br><br>I want to write "password123" as my password, and the program should return "password correct" message.<br><br>Can you please look at the code and correct the mistake.<br><br>```python<br>password = input("Enter password here: ")<br><br>if password == "password123":<br> print("Password enter correct")<br>else:<br> while password != "password123":<br> password = input("Password is invalid, enter correct password: ")<br>```<br>​
Comments (13) 22825 👁️