educative.io

Educative

Possible misleading or confusing question?

An elif condition cannot exist without an if-else statement.

An elif condition cannot exist without a preceding if statement.
For example

if 0:
   pass
elif 1:
   print("no else statement")

But that question implies that a elif condition isn’t possible unless the block ends with a else statement:

if 0:
   pass
elif 0:
   pass
else:
   print("with else statement")

The content in the lesson has been updated. There’s a note explaining that elif`` does not require an elseblock, but does require andif` block.