What are the three necessary parts of an if statement?

(1 point)
• if, a variable, a semi-colon
• if, a print statement, a colon O if, a condition, a colon
• if, a print statement, a semi-colon

1 answer

The correct answer is: if, a condition, a colon.

In Python, an if statement starts with the keyword if, followed by a condition that evaluates to True or False, and it ends with a colon. For example:

if condition:
    # code to execute if condition is True