Make decisions
Use conditions to select a branch.
A comparison such as score >= 90 produces a Boolean value, either True or False. Use == to compare values for equality. Combine conditions with and, or, or not.
Python tries if and elif conditions in order and runs the first matching block. The optional else handles everything left over. Indent each branch by four spaces so Python knows which statements belong to it.
The same program can take a different path when score changes.
Try it yourself
Keep the same score and make Excellent start at 85 and Pass start at 70. Then test the lower boundary with a score of 69. Leave the editor set to 69 when checking.
Target output
Keep practicingShow a hint
The final branch can stay as it is. Change both thresholds and the score.
Ready
Run your code to see the output here.
The first run downloads Python. Code runs in your browser. Progress and drafts are stored on this device.
Show one solution
score = 69
if score >= 85:
print("Excellent")
elif score >= 70:
print("Pass")
else:
print("Keep practicing")