CodingNeed.

2 · Make decisions · 8 MIN

Choose a path

Conditions choose which instructions run.

An if block runs when its condition is true. A colon starts the block and indentation groups its statements. else handles the other case. >= includes the boundary.

A door opens if your ticket is valid. Otherwise, it stays closed.

Read the example

score = 70
if score >= 60:
    print("Pass")
else:
    print("Try again")
Check the expected output
Pass

Your challenge

Return "Pass" for scores at least 60; otherwise return "Try again".

Common trap

Use consistent indentation and include each colon.

Next lesson: Read and fix an error →

Essential cookies keep your account signed in. Optional analytics is not configured on this site. Your choice does not affect access to lessons.

Read the Privacy Policy. You can change this choice in the footer.