[SOLVED] [PYTHON] OR operator works like AND
by czezz from LinuxQuestions.org on (#4VH4N)
Im having a problem with "OR" operator in "if" condition.
At the moment it works like AND.
quit() should be executed if any of the inputs is not numerical/intiger.
Meanwhile, it works ONLY if both inputs are non-numerical/intiger.
I tried to replace | with || and or. No success :(
Can anyone help me out here? What im doing wrong?
Code:#!/usr/bin/python3
import sys
a=input("one: ")
b=input("two: ")
if( a.isdigit() | b.isdigit() ):
print("User input is Number ")
else:
print("One of provided inputs is not a number")
quit()
print (a)
print (b)


At the moment it works like AND.
quit() should be executed if any of the inputs is not numerical/intiger.
Meanwhile, it works ONLY if both inputs are non-numerical/intiger.
I tried to replace | with || and or. No success :(
Can anyone help me out here? What im doing wrong?
Code:#!/usr/bin/python3
import sys
a=input("one: ")
b=input("two: ")
if( a.isdigit() | b.isdigit() ):
print("User input is Number ")
else:
print("One of provided inputs is not a number")
quit()
print (a)
print (b)