+ 1
How the if statement becomes true in the following code?
sex="F"; if(sex=="m" or "M"): print("male") else: print("female") O/P---->male
2 odpowiedzi
+ 6
Keerthivasan J
It becomes true because your "or" condition which as nothing just "M" makes it true.
What you did in or isn't comfirm any condition and thus becomes a universal true statement. Therefore it will be always true.
And or means anyone condition should be true so 2nd is true and it run that.
Also Don't use semicolon ";" in python,it doesn't support as you know.
Happy Learning 🙂
+ 1
Ketan [#Be Happy 😄]
Thank a lot 😁