The else function does not appear even if the "if" conditions are not met pls help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

The else function does not appear even if the "if" conditions are not met pls help

ok here is my code: The problem is when the bro says "no" the condition "if" always appears even if i use "else" or "elif", why? Isn't it supposed that if the input is something other than yes or yeah, is else what appears? pls help # asking the bro are_you_happy = input("You feel bad bro? ") # psicological support loop haha while are_you_happy.upper() == "YES" or "YEAH": print("*give him a hug*") better = input("you feel better bro? ") # he feel better boys :) if better.upper() == "YES" or "YEAH": print("i'm happy for you") break # he don't feel better :( elif better.upper() == "NO": more_support = input("do you want another hug? ") if more_support.upper() == "YES" or "YEAH": print("*give him a very huge hug") print("i hope you well bro") break

14th Aug 2020, 1:59 AM
Silvio
Silvio - avatar
1 Answer
+ 1
I made a couple changes, I put the options in a list, it seemed to help https://code.sololearn.com/crk45Zbn4gqm/?ref=app
14th Aug 2020, 2:11 AM
Steven M
Steven M - avatar