Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Having problems using 'or' in a 'if' statement?
#1
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
Yoriz wrote Jul-22-2019, 09:01 PM:
Improved title of thread
Quote
#2
you mean
if number1 == 6 or number2 == 6:
or better yet
if 6 in (numerb1, number2):
Quote
#3
Thanks !!! Heart Heart Heart
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  problems with the If statement or is it the variables being used NickIgoe 2 268 Mar-22-2019, 06:34 AM
Last Post: NickIgoe

Forum Jump:


Users browsing this thread: 1 Guest(s)