301.9 Selection
Practise exam questionsSelection — Note 1 of 4
Choose between two paths.
An if statement checks a condition — if True, the indented block runs. An optional else block runs when the condition is False. This lets the program choose between two paths.
if condition: runs block when Trueelse: runs when the condition is Falseage = int(input("Age: "))
if age >= 18:
print("Adult")
else:
print("Minor")Specification notes for programming are in Paper 2.