0

Why does this not work?

This code always chooses the first "if". I just simply don't know why. nombre = input("Wie heißt du?\n") print("Guten Tag, " + str(nombre)") while True: listo = input("Bist du bereit das Spiel zu starten?") if listo == "Ja" or "ja" or "J" or "j": print("Super!") break if listo == "Nein" or "nein" or "N" or "n": print("Hast du mich nicht verstanden? Ich erklĂ€re noch mal.") print("TEXT") else: print("Ich habe dich nicht verstanden. Versuche noch mal.") print("TEXT")

21st Jun 2022, 3:59 PM
Dacimbodi
Dacimbodi - avatar
3 Answers
+ 3
I'm seeing an extra " in your second line, when using or in an if expression, make sure to reuse the value you are comparing if listo == "Ja" or listo == "ja" or ... also you might want to compare using the lower function to avoid having too many or if listo.lower() == "ja" or listo.lower() == "j":
21st Jun 2022, 4:08 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
THANK YOU Apollo-Roboto!!! That was it!
21st Jun 2022, 4:29 PM
Dacimbodi
Dacimbodi - avatar
0
Line 3. There is an extra quote at the end. Also, you should provide both input at the first promt in sololearn
21st Jun 2022, 4:07 PM
Slick
Slick - avatar