Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

Which Python keyword is mandatory at the end of a 'while' condition statement?
Options
A Semicolon (;)
B Comma (,)
C Colon (:)
Correct Answer
D Period (.)
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 61 shows the syntax 'while condition:' and explicitly marks ': Colon Must'. This applies to if, elif, else, for, and def as well.

Hint

This is a common syntactical requirement for defining code blocks in Python.

Question Info