Ram

Lesson 3 of 6

Conditions

Use if, elif and else to make decisions.

Conditional statements let a program choose what to do based on whether an expression is true or false.

Indentation is part of Python syntax, so keep code inside each branch aligned consistently.

Example

score = 82
if score >= 80:
    print("Great")
else:
    print("Keep practicing")

Practice challenge

Print 'Adult' when age is 18 or more, otherwise print 'Minor'.

Previous
Next