Why if-else not working | Sololearn: Learn to code for FREE!


Why if-else not working


1/15/2022 4:55:37 PM


2 Answers

New Answer


Correct way to use logical operators(and/or) to join multiple conditions. if like == "abc" or like == "xyz": But in this case, you may try lower() or upper() methods. if like.lower() == "yes":


Hi Rose , I have not very closely looked at your code but I am sure you are doing this mistake by looking if x== "something" or "something else" It is wrong, instead you should write if x=="something" or x=="something else" The reason behind this is or operator is used to compute result from left and right to be true. I cannot explain this more or clearly but you can just read more about or Operator Hope it helps!!