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")
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":
+ 1
THANK YOU Apollo-Roboto!!! That was it!
0
Line 3. There is an extra quote at the end.
Also, you should provide both input at the first promt in sololearn