← Python Programming learning path
Python 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

  1. A variable is a name for a value: age = 20.
  2. Common types: int (10), float (3.5), str ("hi"), bool (True/False).
  3. type(x) tells you the type of x.
  4. Convert types with int(), float(), str().
  5. 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