8
QuizMultiple Choice

Use Data Structures — Cumulative exam

Question 8 • Introduction to Information Technology - EL3701

Find the error in the statement below.if height_variable > 59; print("You can ride this roller coaster.")

Answer
A
The opening parenthesis should be at the beginning of the second line.
B
The second line should not be indented.
C
The semi-colon should be a colon.
D
The > should be a <.

Explanation

In Python, an if statement ends with a colon, not a semicolon. The corrected line is `if height_variable > 59:`; the indented print statement then runs when the height is greater than 59. So the error is that the semicolon should be a colon, choice C.

AI-written and checked against the verified answer.

Previous
Next