Answer to Question #274424 in Python for kika

Question #274424

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


1
Expert's answer
2021-12-03T00:37:09-0500

Chained condition is a condition where each condition is checked in order if the where if the first is false the next is checked and so on.

Example

a=3
q=5
if a<q:
    print("q is greater than a")
elif a>q:
    print("a is greater than q")
else:
    print("a and q are equal")

Nested conditional is an if statement that is nested or inside another if or if/else statement.

Example

n=5
if n<0:
    print("Negative number")
else:
    if n>0 and n<=10:
        print(n*n)

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