Everything a beginner needs on one printable page — variables, data types, strings, lists, dictionaries, loops and functions. Free PDF, no signup, updated for 2026.
# print to screen print("Hello, world!") # comments start with # name = "Ali" # variable age = 16 # int price = 4.99 # float is_on = True # bool type(age) # -> int
7 // 2 # 3 floor divide 7 % 2 # 1 remainder 2 ** 3 # 8 power x += 1 # increment 5 == 5.0 # True equality 5 != 4 # True a and b, a or b, not a
s = "python" s[0] # 'p' s[0:3] # 'pyt' slice len(s) # 6 s.upper() # 'PYTHON' s.replace("py","my") "age: " + str(16) f"Hi {name}, {2+2}" # f-string
nums = [1, 2, 3] nums[0] # 1 nums[-1] # 3 last nums.append(4) # add nums.pop() # remove last len(nums), sum(nums) sorted([3,1,2]) # [1,2,3] [n*2 for n in nums] # comprehension
user = {"name": "Ali", "age": 16}
user["name"] # 'Ali'
user["city"] = "Lahore" # add
user.get("email") # None, no crash
for k, v in user.items():
print(k, v)if score >= 80:
print("A")
elif score >= 70:
print("B")
else:
print("C")
# one-liner
label = "even" if n%2==0 else "odd"for i in range(5): # 0..4 print(i) for item in [1,2,3]: print(item) while n > 0: n -= 1 break # exit loop continue # next iteration
def square(n):
return n * n
def greet(name="friend"):
return f"Hello {name}"
square(4) # 16
greet() # 'Hello friend'name = input("Name? ")
age = int(input("Age? "))
import math
math.sqrt(16) # 4.0
import random
random.randint(1, 6)15 lessons from Hello World to modules — each with its own worksheet and cheat sheet.
Printable worksheets with answer keys for every Python lesson.
The complete interactive Python cheat sheet with quizzes.
What should a Python beginner memorize first?print(), variables, the four core types (int, float, str, bool), if/else, loops, functions and list/dict basics — exactly what is on this page. Everything else can be looked up.
Is this cheat sheet free to download?Yes. Click "Download PDF" (it uses your browser's print-to-PDF) — no signup, no email, free forever.
Which Python version is this for?Standard Python 3 (any 3.x), current as of 2026.
How do I actually get good at Python?Cheat sheets help you recall — practice makes it stick. Do one lesson + its worksheet per day for two weeks.