syntax of elif in python code example
Example 1: python if elif
num = 20
if num > 30:
print("big")
elif num == 30:
print("same")
else:
print("small")
#output: small
Example 2: python else elif
>>> a = 5
>>> if a > 5:
... a = a + 1
... elif a == 5:
... a = a + 1000
... else:
... a = a - 1
...
>>> a
1005