Python Programming for Beginners
Lesson 1 of 3 7 min +50 XP

Variables & Types

Store and label values in Python.

What you'll learn

  • Create a variable
  • Name common types
  • Predict the type of a value
Labelled jars on the shelf

You keep sugar, flour, and salt in labelled jars so you can grab the right one by name. A variable is a labelled jar in the program: 'score = 10' fills the jar named score, and its type — number, text — is what kind of thing the jar holds.

Names for values

A variable is a name bound to a value using =. Python figures out the type automatically.

name = "Ada"   # str
age = 12        # int
pi = 3.14       # float
ready = True    # bool

Knowledge Check

+15 XP / correct

1. What is the type of 3.14 in Python?

2. What type is "Ada"?