python || code example
Example 1: python or
x = 1
y = 10
if x%2 == 0 or y%2 == 0:
print(x%2)
#Output#
#1
Example 2: or in python
# Syntax for Boolean expression with or in Python
exp1 or exp2
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
Example 4: if with && in python
def front_back(a, b):
# +++your code here+++
if len(a) % 2 == 0 && len(b) % 2 == 0:
return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):]
else:
#todo! Not yet done. :P
return