PLAY FREE ▸
Snekcade › Python guides › Print and variables
PYTHON FOR BEGINNERS · PRINT PLAINS

Python print and variables

Your very first Python: show text on the screen and make the computer remember things.

5 min read · updated October 2026

Every Python journey starts with two things: print(), which shows text on the screen, and variables, which remember values for later. Learn these two and you can already write small programs.

PRINT(): SHOW SOMETHING

print("Hello, world!")
print(7 + 3)
Hello, world!
10

Text goes inside quotes. Numbers and math don't need quotes, and Python calculates them first.

VARIABLES: GIVE A VALUE A NAME

A variable is like a labelled box. You put a value in with = and use the name later.

name = "Mia"
coins = 3
print(name, "has", coins, "coins")
Mia has 3 coins
Read = as "gets". coins = 3 means "coins gets the value 3". It is not a question.

CHANGING A VARIABLE

coins = 3
coins = coins + 5
print(coins)
8

Python works out the right side first (3 + 5), then stores the answer back in coins. A shorter way to write the same thing is coins += 5.

THE MAIN TYPES OF VALUES

print(type("snek"))
print(type(42))
print(type(3.5))
<class 'str'>
<class 'int'>
<class 'float'>

MATH

print(10 / 4)
print(10 // 4)
print(10 % 4)
print(2 ** 3)
2.5
2
2
8

/ divides normally, // drops the decimals, % gives the remainder and ** is "to the power of".

F-STRINGS: TEXT WITH VALUES INSIDE

Put an f before the quotes and write variables in curly brackets. This is the easiest way to build sentences.

player = "Ivo"
score = 120
print(f"{player} scored {score} points!")
Ivo scored 120 points!
WHAT DOES THIS PRINT?
a = 5
b = a
a = 10
print(b)
b = a copies the value at that moment (5). Changing a later does not change b.

COMMON BEGINNER MISTAKES

Mixing text and numbers with +. "Score: " + 5 is an error. Use an f-string, or str(5).
Forgetting quotes. print(hello) looks for a variable called hello. You probably meant print("hello").
Spaces or dashes in names. my score and my-score are not allowed. Use my_score.
WHAT DOES THIS PRINT?
x = "3"
y = 4
print(x * y)
x is the text "3", not the number 3. Multiplying text by 4 repeats it 4 times: 3333.

PRACTICE IT, DON'T JUST READ IT

Print Plains is the first world in Snekcade: tiny lessons, real Python on your phone, and an explanation for every answer. Free, no account needed.

PLAY PRINT PLAINS ▸

FAQ

What is a variable in Python?

A name that stores a value so you can use it later, for example score = 10. You can change it at any time.

What is an f-string?

Text with an f before the quotes, like f"Hi {name}". Anything in curly brackets is replaced by its value.

Why does "Score: " + 5 give an error?

You cannot add text and a number. Turn the number into text with str(5), or use an f-string.