🐍 Python Quick Reference Card

Module 1: What is Python & Getting Started

Python is CASE-SENSITIVE: print() works, Print() does NOT!

What is Python?

High-level: Handles complexity for you
Interpreted: Runs line by line
Dynamically typed: No type declarations
Indentation-based: Whitespace matters!

Created By

Guido van Rossum in 1991
Named after Monty Python (not the snake!)
We use Python 3 (Python 2 retired 2020)

The print() Function

# Basic printing
print("Hello, World!")

# Multiple items (adds spaces)
print("Age:", 25)

# Math in print
print("Sum:", 3 + 4)

# Empty line
print()

Comments

# This is a comment
print("Hi") # Inline comment
# print("Commented out code")

Comments start with #
Python ignores everything after #
Use comments to explain why, not what

Strings (Text)

# Single or double quotes
"Hello"
'Hello'

# Apostrophes? Use double quotes
"It's fun"

# Quote marks? Use single quotes
'She said "hi"'

Arithmetic Operators

OperatorNameExampleResult
+Addition5 + 38
-Subtraction10 - 46
*Multiplication6 * 742
/Division15 / 43.75
//Integer Div15 // 43
%Modulo15 % 43
**Power2 ** 38
/ always returns float
// rounds DOWN to int

Data Types (Preview)

TypeNameExamples
intInteger42, -7, 0
floatDecimal3.14, -0.5
strString"hello", '42'
boolBooleanTrue, False
type(42)     # <class 'int'>
type("42")   # <class 'str'>

The REPL

Read → Eval → Print → Loop

Start: type python in terminal
Exit: type exit() or quit()
Prompt: >>> means ready for input

Running Python

Script File

Save as filename.py
Run: python filename.py
In IDLE: press F5

File Naming Rules

Use .py extension
Lowercase + underscores
No spaces in names
Never name it python.py!

Useful Functions

print()   # Display output
type()    # Check data type
help()    # Get documentation
exit()    # Leave the REPL

Common Errors to Avoid

Free Python Learning Platform • Safaa Dabagh • sdabagh.github.io • © 2025