or python code example

Example 1: or statement python

if x==1 or y==1:
  print(x,y)

Example 2: ord python

# The ord() function returns an integer representing the Unicode character.
res = ord('A')
print(res)
# output 65

Example 3: python or

x = 1
y = 10

if x%2 == 0 or y%2 == 0:
  print(x%2)
  
#Output#
#1

Example 4: ** in python

#** is the exponent symbol in Python, so:
print(2 ** 3)
#output: 8

Example 5: or in python

# Syntax for Boolean expression with or in Python
exp1 or exp2

Example 6: logical operators in python

condition1 and condition2
condition1 or condition2
not condition

Tags:

Cpp Example