Having problems using 'or' in a 'if' statement? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Having problems using 'or' in a 'if' statement? (/thread-19957.html) |
Having problems using 'or' in a 'if' statement? - umut3806 - Jul-21-2019 number1 = 5 number2 = 10 if number1 or number2 == 6: print("Successful !") else: print("Failed !")My problem is that the code isn't working as ı want.It writes "Successful" on the screen.But it shouldn't.Because the each side of the or isn't 6. So it's false.It should write "Failed !". Help Me Plzzz ... RE: A problem with "and" "ore" conjunctions... - metulburr - Jul-21-2019 you mean if number1 == 6 or number2 == 6:or better yet if 6 in (numerb1, number2): RE: A problem with "and" "ore" conjunctions... - umut3806 - Jul-21-2019 Thanks !!! |