Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

In Python's conditional constructs like `if-elif-else`, what punctuation mark is mandatory at the end of the `if`, `elif`, and `else` lines?
Options
A Semicolon (;)
B Comma (,)
C Colon (:)
Correct Answer
D Period (.)
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 41 of the document explicitly highlights ": Colon Must" next to the if, elif, and else keywords, indicating that a colon is required to introduce the code block.

Hint

Think about the common syntax for defining code blocks in Python after statements like `if`, `for`, `while`, or function definitions.

Question Info