Are if-if and if-elif defined as chained conditionals?

64 Views Asked by At

I know the difference between if-if vs if-elif statements, but do both belong to the definition of a chained conditional, or is the definition of chained conditionals only with if-elif statements correct?

1

There are 1 best solutions below

0
vkozyrev On BEST ANSWER

Yes, you are right. This is a chained conditional statement.

if 1 > 2:
    print("1 > 2")
elif 2 == 1:
    print ("2 == 1")
else:
    print("2 > 1")

And this is a sequence of conditional statements that are not chained together.

if 2 > 1:
    print("2 > 1")
if 3 > 2:
    print("3 > 2")