← Python Programming learning pathPython Programming · Module 2 of 10
Variables and data types
Variables store values; every value has a type such as int, float, str or bool.
📖 Key ideas
- A variable is a name for a value: age = 20.
- Common types: int (10), float (3.5), str ("hi"), bool (True/False).
- type(x) tells you the type of x.
- Convert types with int(), float(), str().
- Names are case-sensitive: Age and age are different.
💡 Real-life example: A variable is a labelled box: the label is the name, and what you put inside is the value.
intWhole number type
floatDecimal number type
strText type
boolTrue or False type