Reading · 10 min

Variables, types and decisions

You are previewing a free lesson. Enrol to save progress and take quizzes.

A variable is a name for a value: price = 2500. Python works out the type for you, but you still need to know it, because adding a number to text causes an error.

if, elif and else let a program choose what to do. Indentation is not decoration in Python: it defines which lines belong to which block.