+ 2

How can i do so, that when i give "Im fine thanks" it gives "No problem. How old are u?"

y = input("How are u:") if y in ("Im fine", "I'm fine", "Good", "Good!", "Im fine!", "Good.","Im fine.", "I'm fine", "I'm fine!"): print("Good, how old are u?") elif y == "Not good"or "Not Good" or "Not Good..." or "Not good." or "Not Good." or "Not good..." or "Bad" or "bad": print("How old are u?") elif y == "Im fine thanks" or "Im fine thanks!" or "I'm fine, thanks!" or "Im fine, thanks!" or "Im fine, thanks" or "Im fine, thanks!" or "Im fine, thanks" or "I'm fine, thanks." or "I'm fine thanks!": print("No problem, how old are u?") else: print("What?")

27th Sep 2018, 9:48 AM
Joe
Joe - avatar
5 Respostas
+ 2
У тебя снова та же ошибка. почему в условии if ты правильно написал проверку, а в elif - по-старому? elif y in ("Not good"or "Not Good" or "Not Good..." or "Not good." or "Not Good." or "Not good..." or "Bad" or "bad") и так далее
27th Sep 2018, 10:33 AM
strawdog
strawdog - avatar
+ 1
Говоришь как учитель)Но спасибо, буду лечиться)
27th Sep 2018, 10:34 AM
Joe
Joe - avatar
+ 1
how about instead of trying to anticipate exactly what the user types by putting in somany options you just accept user input then continue from there. i feel like it’s alot more complicated than it should be
29th Sep 2018, 2:28 PM
Devo
Devo - avatar
0
I believe that if you want to use ‘or’s like that, you need to restate the condition, but I am unsure. I have an issue with that.
27th Sep 2018, 11:36 AM
Ben Bistline
Ben Bistline - avatar
0
You could check to see if general words like bad or good, is in the input and then go from there.
29th Sep 2018, 6:29 PM
Ben Bistline
Ben Bistline - avatar