</> CodeWithMe
Sign in
← 🐍 Python for Beginners

Variables

A variable is a name that stores a value:

name = "Anna"
year = 2026
print(name, year)

To insert a variable into a string, use f-strings:

print(f"Hello, {name}!")

Challenge

  1. Create a variable age with the value 25.
  2. Print I am 25 years old using an f-string and the age variable.
Loading Python (about 5 seconds the first time)…