Variables & Data Types

Creating Variables

Variables: Storing Data 📦

A variable is like a labeled box that stores a value.

Creating Variables

In Python, you create a variable by giving it a name and a value:

name = "Alice"
age = 25

Rules for Variable Names:

  • Must start with a letter or underscore
  • Can contain letters, numbers, underscores
  • Case-sensitive (
    name
    and
    Name
    are different)
  • Cannot be a Python keyword

Good Examples:

user_name = "Bob"
score1 = 100
_private = "secret"
Visualizer
"Alice"
assigned to
"Alice"
name

Interactive Visualization

python
Loading...
Output
Run execution to see output...