Python OR Operator Last Updated : 21 Aug, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report Python OR Operator takes at least two boolean expressions and returns True if any one of the expressions is True. If all the expressions are False then it returns False.Flowchart of Python OR OperatorTruth Table for Python OR OperatorExpression 1Expression 2ResultTrueTrueTrueTrueFalseTrueFalseTrueTrueFalseFalseFalseUsing Python OR Operator with Boolean ExpressionPython OR operator returns True in any one of the boolean expressions passed is True.Example: Or Operator with Boolean Expression Python bool1 = 2>3 bool2 = 2<3 print('bool1:', bool1) print('bool2:', bool2) # or operator OR = bool1 or bool2 print("OR operator:", OR) Outputbool1: False bool2: True OR operator: True Using Python OR Operator in ifWe can use the OR operator in the if statement. We can use it in the case where we want to execute the if block if any one of the conditions becomes if True.Example: Or Operator with if statement Python # or operator with if def fun(a): if a % 5 == 0 or a % 3 == 0: print('a either a multiple of 3 or 5') else: print('a is not a multple of 3 or 5') # driver code fun(10) fun(22) fun(5) Outputa either a multiple of 3 or 5 a is not a multple of 3 or 5 a either a multiple of 3 or 5 Python OR Operator - Short CircuitThe Python Or operator always evaluates the expression until it finds a True and as soon it Found a True then the rest of the expression is not checked. Consider the below example for better understanding.Example: Short Circuit in Python OR Operator Python # short circuit in Python or operator def true(): print("Inside True") return True def false(): print("Inside False") return False case1 = true() or false() print("Case 1") print(case1) print() case2 = true() or true() print("Case 2") print(case2) print() case3 = false() or false() print("Case 3") print(case3) print() case4 = false() or true() print("Case 4") print(case4) OutputInside True Case 1 True Inside True Case 2 True Inside False Inside False Case 3 False Inside False Inside True Case 4 True From the above example, we can see that the short circuit or lazy evaluation is followed. In case1 and case2, the second expression is not evaluated because the first expression returns True, whereas, in case3 and case4 the second expression is evaluated as the first expression does not returns True. Comment More infoAdvertise with us Next Article Precedence and Associativity of Operators in Python N nikhilaggarwal3 Follow Improve Article Tags : Python Practice Tags : python Similar Reads Python Operators In Python programming, Operators in general are used to perform operations on values and variables. These are standard symbols used for logical and arithmetic operations. In this article, we will look into different types of Python operators. OPERATORS: These are the special symbols. Eg- + , * , /, 6 min read Precedence and Associativity of Operators in Python In Python, operators have different levels of precedence, which determine the order in which they are evaluated. When multiple operators are present in an expression, the ones with higher precedence are evaluated first. In the case of operators with the same precedence, their associativity comes int 4 min read Python Arithmetic OperatorsPython Arithmetic Operators Python operators are fundamental for performing mathematical calculations. Arithmetic operators are symbols used to perform mathematical operations on numerical values. Arithmetic operators include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). OperatorDescriptionS 4 min read Difference between / vs. // operator in Python In Python, both / and // are used for division, but they behave quite differently. Let's dive into what they do and how they differ with simple examples./ Operator (True Division)The / operator performs true division.It always returns a floating-point number (even if the result is a whole number).It 2 min read Python - Star or Asterisk operator ( * ) The asterisk (*) operator in Python is a versatile tool used in various contexts. It is commonly used for multiplication, unpacking iterables, defining variable-length arguments in functions, and more.Uses of the asterisk ( * ) operator in PythonMultiplicationIn Multiplication, we multiply two numbe 3 min read What does the Double Star operator mean in Python? The ** (double star)operator in Python is used for exponentiation. It raises the number on the left to the power of the number on the right. For example:2 ** 3 returns 8 (since 2³ = 8)It is one of the Arithmetic Operator (Like +, -, *, **, /, //, %) in Python and is also known as Power Operator.Prec 2 min read Division Operators in Python Division Operators allow you to divide two numbers and return a quotient, i.e., the first number or number at the left is divided by the second number or number at the right and returns the quotient. There are two types of division operators: Float divisionInteger division( Floor division)When an in 5 min read Modulo operator (%) in Python Modulo operator (%) in Python gives the remainder when one number is divided by another. Python allows both integers and floats as operands, unlike some other languages. It follows the Euclidean division rule, meaning the remainder always has the same sign as the divisor. It is used in finding even/ 4 min read Python Logical Operators Like