Start learning →
Home › CS Olympiad › Computer Science › Booleans and Decisions › An elif statement is only legal when it directly…

An elif statement is only legal when it directly follows an if or another:

Aelse
Bwhile
Cprint
Delif
Answer & Solution
Correct answer: D. elif
1. elif is part of a chain, never alone. 2. It must attach to a previous test. 3. So it follows an if or another elif. _Source: OpenStax Introduction to Python Programming, Chapter 4._
Practise this question with Quill — CS Olympiad →
Related questions