What's wrong with this code password not working | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

What's wrong with this code password not working

iit supposed to ask user name and correct password but it also take wrong password too https://code.sololearn.com/c4WP19rrjyKk/?ref=app

21st Jan 2018, 12:20 PM
Akash Kumar Singh
Akash Kumar Singh - avatar
2 Antworten
+ 3
It is more easy for us if you insert your code next time. But I have found it, you should use brackets in your if statement like this: if (username == "akash" or username=="akash " or username =="Akash") and password =="akash@123": If you don't use brackets, one of the or's is enough.
21st Jan 2018, 12:34 PM
Paul
Paul - avatar
+ 7
It should work now when you group the ORs by brackets since AND is executed before OR. Correct me if I'm wrong, hope it helps! ;) https://code.sololearn.com/cT4hBv8nKa5v/?ref=app
21st Jan 2018, 12:29 PM
Nigel Yong
Nigel Yong - avatar