Answer to Question #273289 in Python for Snave

Question #273289

Give example of chained conditional


1
Expert's answer
2021-11-29T12:29:40-0500
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')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS