Give example of chained conditional
n = 3
# a chained conditional can have an infinite
# number of conditions to test
# but only one condition will be execut
if n == 0:
print('Zero')
elif n == 1:
print('One')
elif n == 2:
print('Two')
elif n == 3:
print('Three')
elif n == 4:
print('Four')
elif n > 2:
print('Bigger than Two')
else:
print('Another Num')
Comments
Leave a comment