Skip to content

AI Engineering

Variables and scalar types

Variables and common scalar types give names to values used in a program.

Guess first. It doesn't count.

What number does this code display?

batch_size = 4batch_size = 8print(batch_size)

Your answer starts the 3-minute lesson. No sign-up needed.

What you'll learn4 ideas
  • A variable is a name that refers to a value.
  • Assignment connects a name on the left of `=` to a value on the right.
  • Reassignment connects an existing name to a new value.
  • `print(name)` displays the value the name refers to when that line runs.
Chapter 1: Python values and expressions6 lessons · 22 min

This lesson is part of the AI Engineering course.

Example plan3 lessons · 10 min

Variables and scalar typesPython values and expressions3 min
Python scalar typesPython values and expressions4 min
Arithmetic expressionsPython values and expressions3 min

An example. Your plan follows your answers, so it can start later and end sooner.

Build my plan

Start free, no account needed.