Question Detail

COS 102 If staments Objective Question

Question

What is considered a common syntax error in Python if statements, as highlighted in the document?
Options
A Using 'print' instead of 'show'
B Forgetting the colon (<code>:</code>) at the end of the <code>if</code> condition line
Correct Answer
C Placing the <code>else</code> statement before the <code>if</code> statement
D Using too many spaces for indentation
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 15, 'Mistake #2: Colon & Indent', specifically points out 'The Colon: if score > 50 ← Error! Missing :'

Hint

Recall the two main syntax requirements for `if` statements mentioned under 'Mistake #2'.

Question Info