Reference · grows each quest

Python Cheat Sheet

Showing things: print

From Quest 1: First Words · Python Tutorial 3.1.2

You writePython shows
print("Hello!")
Hello!

Text in quotes is a string. Quotes are not shown.

print('Hello!')
Hello!

Single or double quotes: same thing. Both sides must match.

print(2 + 2)
4

No quotes: Python does the math.

print("2 + 2")
2 + 2

Quotes: it's just text.

print("Hi")
print("there")
Hi
there

Each print starts a new line. Lines run top to bottom.

Math

+  -  *  /
plus minus times divide

Python Tutorial 3.1.1

Common errors

print("Hi)
SyntaxError

A quote or bracket has no partner. Add the closing one.

Print("Hi")
NameError

Python doesn't know the word. Check spelling and capitals.