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

0

Why if-else not working

https://code.sololearn.com/cK60F4qTdb2E/?ref=app

1/15/2022 4:55:37 PM

Rose

2 Answers

New Answer

+4

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":

+1

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!!