Development preview · Sample courses · No real payments or qualifications issued
← Computing & programming foundations
Computing · Lesson 2 of 3

Making decisions

The essentials

An if statement executes a block when a condition is true. An else block executes when the condition is false. In Python, indentation identifies which statements belong to a block.
Worked example
score = 65 if score >= 60: result = "Pass" else: result = "Try again" The result is "Pass".
Check your understanding

For score = 60, is score >= 60 true or false?

Choose one answer
Sign in with ChatGPT to practise

Practice is untimed. Retry as needed. A correct answer marks this sample lesson complete.

← Previous lessonNext lesson →