Teyro
CoursesFor creatorsBlog
Log inGet started
Tey Mascot
LOADING.

Every expert you admire was once a beginner who refused to quit.

Teyro

The fun way to finish learning coding and AI: short daily lessons with streaks, leagues and friends.

Get the app

Learn

  • All courses
  • Learn coding
  • Learn AI
  • Learn online
  • How it works
  • Leagues
  • Get the app

Creators

  • Teach on Teyro
  • How teaching works
  • Teach coding online
  • Teach AI online
  • Join as a Founding Creator
  • Creator log in

Resources

  • Blog
  • Features
  • Use cases
  • Compare
  • FAQ

Legal

  • Terms of Use
  • Privacy Policy

© 2026 Teyro · support@teyro.app

HomeBlogSkill Building & Careers
Skill Building & Careers

Python Cheat Sheet for Beginners: Syntax You Need (Free, Printable)

A free Python cheat sheet for beginners: variables, strings, lists, dictionaries, loops, functions and files in one page. Copy it, print it, or save it as a PDF.

The Teyro TeamOct 25, 20263 min read
On this page16 sections
  1. Direct answer
  2. Variables and data types
  3. Maths
  4. Strings
  5. Input and output
  6. Conditions
  7. Lists
  8. Dictionaries
  9. Loops
  10. Functions
  11. Files
  12. Errors
  13. Handy built-ins
  14. Common beginner errors
  15. How to use this sheet
  16. The bottom line

A cheat sheet does not teach you Python. It saves you from forgetting the syntax while you practise. Here is a one-page Python cheat sheet for beginners. Print it (use your browser's Save as PDF if you prefer a file), and keep it next to you while you code.

Direct answer

The core of beginner Python is variables, strings, lists, dictionaries, conditions, loops, functions and files. The sections below show each with the syntax you need.

Variables and data types

name = "Ada"        # string (str)
age = 30            # integer (int)
price = 4.99        # float
is_ready = True     # boolean (bool)
type(age)           # <class 'int'>

Maths

10 + 3    # 13
10 - 3    # 7
10 * 3    # 30
10 / 3    # 3.333... (always a float)
10 // 3   # 3 (whole number division)
10 % 3    # 1 (remainder)
2 ** 3    # 8 (power)

Strings

s = "hello world"
len(s)                 # 11
s.upper()              # "HELLO WORLD"
s.title()              # "Hello World"
s.replace("l", "L")    # "heLLo worLd"
s.split(" ")           # ["hello", "world"]
s[0]                   # "h"
s[0:5]                 # "hello"
f"Hi {name}, you are {age}"   # f-string

Input and output

answer = input("Your name? ")   # always a string
n = int(input("A number: "))    # convert to a number
print("Hello", answer)

Conditions

if age >= 18:
    print("adult")
elif age >= 13:
    print("teen")
else:
    print("child")

# comparisons: ==  !=  <  >  <=  >=
# logic:       and  or  not

Lists

fruits = ["apple", "pear"]
fruits.append("plum")    # add to end
fruits.remove("pear")    # remove by value
fruits[0]                # first item
fruits[-1]               # last item
len(fruits)              # how many
"apple" in fruits        # True
sorted([3, 1, 2])        # [1, 2, 3]

Dictionaries

person = {"name": "Ada", "age": 30}
person["name"]            # "Ada"
person["city"] = "Paris"  # add or change
person.get("job", "n/a")  # "n/a" if missing
for key, value in person.items():
    print(key, value)

Loops

for i in range(5):        # 0 to 4
    print(i)

for fruit in fruits:
    print(fruit)

n = 3
while n > 0:
    print(n)
    n -= 1

# break = leave the loop, continue = skip to the next round

Functions

def add(a, b=0):
    return a + b

add(2, 3)   # 5
add(2)      # 2

Files

with open("notes.txt", "w") as f:
    f.write("hello\n")

with open("notes.txt") as f:
    text = f.read()

Errors

try:
    n = int(input("Number: "))
except ValueError:
    print("That was not a number")

Handy built-ins

FunctionWhat it does
len(x)length of a string, list or dictionary
range(n)numbers from 0 to n-1
sum(list)add up a list of numbers
min(list), max(list)smallest, largest
sorted(list)a new sorted list
round(x, 2)round to 2 decimals
type(x)the data type

Common beginner errors

  • IndentationError: the spaces at the start of a line do not match. Use four spaces.
  • NameError: you used a name you have not defined (often a typo).
  • TypeError: mixing types, such as adding a string and a number. Convert with int() or str().
  • SyntaxError: a missing colon, bracket or quote.

How to use this sheet

Keep it open, but do not copy and paste. Type each snippet, change the values, and predict the result before you run it. For a practice plan, see learn Python in 30 days, and for a project list, Python projects for beginners.

The bottom line

A cheat sheet is a memory aid. The skill comes from writing code every day. The Python for Beginners course gives you short lessons with real code to run, free to start.

Frequently asked questions

Is there a free Python cheat sheet for beginners?

Yes. This page is one: it covers variables, strings, lists, dictionaries, loops, functions and files. Print this page or use your browser's Save as PDF option to keep a copy.

How do I save this cheat sheet as a PDF?

Open your browser's print dialog (Ctrl+P or Cmd+P) and choose Save as PDF as the destination.

What are the most important Python basics?

Variables and data types, conditions, loops, lists and dictionaries, and functions. Almost every beginner program uses these.

Does a cheat sheet help me learn Python?

It helps as a reference, but you learn by writing code. Use it while practising, not instead of it.

Practise it, don't just read it

The Python for Beginners course turns every line of this sheet into short lessons with real code you run. Free to start.

See the Python course

Free to start · No credit card needed

Share

Written by

The Teyro Team

Learning Team at Teyro

We build Teyro — an AI-powered learning platform that turns skill-building into a daily habit through bite-sized, gamified lessons. We write about the learning science and study strategies that shape our product.

More from The Teyro Team

On this page

  • Direct answer
  • Variables and data types
  • Maths
  • Strings
  • Input and output
  • Conditions
  • Lists
  • Dictionaries
  • Loops
  • Functions
  • Files
  • Errors
  • Handy built-ins
  • Common beginner errors
  • How to use this sheet
  • The bottom line

Keep reading

Skill Building & Careers

Best Careers for 2027: High-Demand Jobs and the Skills to Get Them

The best careers for 2027 and the jobs most in demand, based on BLS and World Economic Forum data, plus the skills each path needs.

Oct 30, 20263 min read
Skill Building & Careers

Best Certifications for 2027: Tech, Data, Cloud and Business

The best certifications for 2027 in cloud, security, data, project management and AI, who each one suits, and when a portfolio matters more.

Oct 30, 20263 min read
Skill Building & Careers

Best Programming Language to Learn in 2027 (for Your Goal)

The best programming language to learn in 2027 depends on what you want to build. Compare Python, JavaScript, TypeScript, SQL and C.

Oct 30, 20263 min read