whats wrong? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

whats wrong?

the problem is when i write "Yahel" and at the password "1234" its not saying what it supposed to say... code: my_input = input ("Enter your name:\n") my_input = my_input.capitalize() my_pass = input ("Enter your password:\n") Pass_not_correct = my_pass != 1234 Name_not_correct = my_input != "yahel" if my_input == "Yahel" and my_pass == 1234: print ("Hello " + my_input + " , you are logged in...") elif my_input == "Yahel" and Pass_not_correct: print ("the password is incorrect.") elif Name_not_correct and my_pass == 1234: print ("the name is incorrect") else: print ("your name is not in the System")

6th Jun 2020, 5:17 PM
Yahel
Yahel - avatar
3 Respuestas
+ 2
cuz you are testing 1234 against "1234" Make ur boolean variable look like this: Pass_not_correct = my_input != "1234" This is bcuz input() returns a string rather than a number
6th Jun 2020, 5:28 PM
Ambele Newton
Ambele Newton - avatar
+ 1
Thunderbolt thank you!
6th Jun 2020, 5:44 PM
Yahel
Yahel - avatar
0
yahel make a habit to attach file with code. Sometimes to debug the code user has to run it.
7th Jun 2020, 5:42 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar