Skip to content

Making decisions

Read · 1 of 4

if … else, with a colon and an indent

if condition: runs the indented lines below it only when the condition is True. else: covers the other case.

Python uses indentation (4 spaces) to know which lines belong inside. Lines back at the left run afterwards, either way.