Python

Creating Variables

Variables

Variables store data for later use. In Python, you create a variable with =.

name = "Alice"
age = 25
height = 5.6

Data Types

TypeExampleDescription
str"Hello"Text (string)
int42Whole number
float3.14Decimal number
boolTrueTrue or False

Your Task

  • Create a variable name with the value "Python"
  • Create a variable year with the value 1991
  • Print both variables
script.py
Loading PYTHON engine...
Downloading Python… (one-time, ~10 MB)

Downloading Python… (one-time, ~10 MB)

This runs entirely in your browser and is cached for next time.