Python Forum

Full Version: Having problems using 'or' in a 'if' statement?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ... Huh Huh Huh
you mean
if number1 == 6 or number2 == 6:
or better yet
if 6 in (numerb1, number2):
Thanks !!! Heart Heart Heart