Answer to Question #274412 in Python for kika

Question #274412

Describe the difference between a chained conditional and a nested conditional. Give your own example of each. 


1
Expert's answer
2021-12-02T06:48:02-0500


In chained conditionals if/else/elif flow controls are indented , all to the same depth while no nesting between them whereas in nested conditionals the flow controls vary in depth.


The key distinct differentiator between nested and chained conditionals is nesting.


# Nested Conditional


def flow_if(due, overdue):

if overdue == True:

if due > 10000:

print('Amount is due!! ')

elif 10000 > due > 1000:

print('Target is met')

else:

print("Nest ")

else:

print("Late..")


# chained conditional

def flow_if(account):

if account > 10000:

print('Bye')

elif account < 0:

print('Less amount !!')

else:

print("No amount")



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