logical operator python code example
Example 1: ** in python
# ** means modulus. or exponent
x = 6
y = 2
print(x**y) # will print 6 raised to power 2
Example 2: logical operators python
Python uses and and or conditionals.
i.e.
if foo == 'abc' and bar == 'bac' or zoo == '123':
# do something
Example 3: logical operator in python
# logical and operator
# return first operands if false otherwise second operands
0 and 3
# output = 0
3 and 0
# output = 0
3 and 5
# output = 5