How to Learn Python from Scratch: A Step-by-Step Study Plan for Beginners
Learn Python from scratch in order: installation and your first script, variables and types, conditions and loops, collections, functions, errors, modules, files, then classes and asynchronous code. Reinforce each topic with exercises and one running pet project; with 5–7 hours a week, the basics take 2–3 months.
Learning Python from scratch is easier than it seems if you follow the right order: first installation and your first script, then types, conditions and loops, collections, functions, errors, modules and files, and only then classes and asynchronous code. Below is a step-by-step study plan for beginners: what to learn at each stage, which exercises and projects to do and how not to get stuck.
Why Python is a good first language
Python has a short, readable syntax: blocks are defined by indentation rather than brackets, and a program of three lines already does something useful. It is used for web back ends, automation, data analysis, machine learning and DevOps scripts, so the basics you learn will be useful wherever you go next.
To start you only need a computer with Windows, macOS or Linux and the basic ability to open a terminal. No programming experience is required, and at first the maths is no harder than at school.
Another advantage is the huge community. For almost any error a beginner runs into, an answer already exists, and for most tasks — from reading Excel tables to sending emails — there is a ready-made library. That is why, after just a few weeks of study, you can write programs that save you time in real life.
Which version to learn
Learn the current version of Python 3 — at the moment that is 3.15. Many books and older tutorials were written for 3.8–3.10 and teach workarounds that newer versions no longer need. Python 3.10 stops receiving security fixes in October 2026, and new versions come out every October.
The core of the language has changed very little between versions, so a classic Python textbook for beginners is still useful. Just keep in mind that if an example from a book looks clumsy, the newer version may already have a built-in tool for it.
The Python study plan step by step
| Stage | What to study | Time estimate |
|---|---|---|
| 1. Getting started | installation, REPL, running a script, print, input | 1–2 days |
| 2. Basics | variables, numbers, strings, f-strings, if, for, while | 1–2 weeks |
| 3. Collections | lists, tuples, dictionaries, sets, comprehensions | 1–2 weeks |
| 4. Functions | parameters, return, scope, type annotations | 1 week |
| 5. Errors and modules | tracebacks, try/except, import, standard library, packages | 1–2 weeks |
| 6. Files and data | with open, CSV, JSON, pathlib | 1 week |
| 7. OOP | classes, methods, inheritance, dataclasses | 1–2 weeks |
| 8. What next | asynchronous code, testing, profiling, choosing a direction | depends on you |
These timings assume roughly 5–7 hours a week. Regularity matters more than speed: half an hour every day gives more than five hours once a week.
Step 1. Installation and your first script
Install a fresh Python from python.org or with the uv manager and check the version with python3 --version (on Windows, python --version). Try the interactive console: run python3 without arguments and experiment with expressions after the >>> prompt.
Then create your first file, hello.py, and run it. The goal of this stage is to understand the difference between the console for experiments and a script that runs from top to bottom.
name = input("What is your name? ")
print(f"Hello, {name}!")
Step 2. Python basics: syntax, types, conditions and loops
This is the foundation. Get to know the main types — int, float, str, bool — and the idea that in Python a variable is a name bound to an object. Learn to format output with f-strings, compare values and build branches.
amount = 1250
if amount > 1000:
print("Large purchase")
elif amount > 100:
print("Regular purchase")
else:
print("Small change")
for i in range(1, 4):
print(i, i ** 2)
The main feature of Python syntax for beginners is indentation. The body of an if, a loop or a function is indented by 4 spaces, and an indentation mistake is the most common error in the first days (IndentationError).
Exercises to practise
- A program asks for your age and says whether you are an adult.
- Print the multiplication table for a given number.
- A "guess the number" game with "higher/lower" hints, using
whileand therandommodule.
Step 3. Collections: lists, dictionaries, sets
Almost every real program works with sets of data. Lists store ordered items, dictionaries store key–value pairs, sets store unique values, and tuples are immutable sequences. Comprehensions also belong here — a short notation for building lists and dictionaries.
expenses = [("coffee", 250), ("taxi", 600), ("coffee", 180)]
totals = {}
for item, amount in expenses:
totals[item] = totals.get(item, 0) + amount
print(totals) # {'coffee': 430, 'taxi': 600}
big = [a for _, a in expenses if a > 200]
print(big) # [250, 600]
Python 3.15 added new tools to collections: the immutable dictionary frozendict (PEP 814) protects settings from accidental changes, and unpacking with an asterisk inside comprehensions (PEP 798) removes clumsy constructions. Beginners should first get confident with classic lists and dictionaries.
Step 4. Functions
Functions turn a piece of code into a named tool. Learn to declare functions with def, pass arguments (positional, keyword, with default values), return results and annotate types.
def total(expenses: list[tuple[str, int]], min_amount: int = 0) -> int:
return sum(a for _, a in expenses if a >= min_amount)
print(total([("coffee", 250), ("bread", 60)], min_amount=100)) # 250
A good rule: if a piece of code repeats twice, move it into a function.
Step 5. Errors, modules and packages
Learn to read a traceback from the bottom up: the last line says what happened, and the lines above say where. Recent Python versions add hints such as "Did you mean", so read them rather than panic at red text. Handle exceptions with try/except and a specific error type.
try:
amount = int(input("Amount: "))
except ValueError:
print("Please enter a number")
Then come modules and imports: how to split code across files, what the standard library offers (math, random, datetime, pathlib, json, csv), and how to install third-party packages into a virtual environment with pip or uv. Python 3.15 introduced lazy imports (PEP 810): a module is loaded only on first use, which speeds up program start-up.
Step 6. Working with files
A program that reads and saves data is already useful. Master with open(...), the csv and json modules, and working with paths through pathlib.
import csv
with open("expenses.csv", encoding="utf-8") as f:
rows = list(csv.DictReader(f))
print(sum(int(r["amount"]) for r in rows))
Specify encoding="utf-8" explicitly — that way the code behaves the same on every system. In Python 3.15 UTF-8 became the default encoding (PEP 686), but specifying it explicitly does no harm if the program is run on an older version.
Step 7. Classes and OOP
Classes combine data and behaviour. Study class, __init__, methods, attributes, inheritance and special methods such as __str__. For simple records with fields, use dataclasses — they require less boilerplate code.
from dataclasses import dataclass
@dataclass
class Expense:
item: str
amount: int
e = Expense("coffee", 250)
print(e) # Expense(item='coffee', amount=250)
Step 8. What next: asynchronous code, profiling and a direction
Once you have the basics, get acquainted with asynchronous programming (async/await, the asyncio module) — it is needed for network requests and bots — and with finding slow spots in code. Python 3.15 introduced a built-in profiler, Tachyon (PEP 799). In parallel, learn testing (pytest) and Git.
Then choose a direction: web (Django, Flask, FastAPI), data analysis (pandas, Jupyter), automation and scripts, bots, machine learning. Frameworks are learned much faster once the language basics are solid.
Beginner pet projects in Python
Textbook tasks reinforce syntax, but you learn programming best on your own project that grows with you. A good approach is one running project, to which each new topic adds one feature.
- Expense tracker — first it prints one expense, then totals by category, reads a CSV, saves a report and fetches currency exchange rates.
- File organiser — renames photos by date, sorts the Downloads folder.
- Telegram bot — reminders or a to-do list.
- Parser — collects data from a web page and saves it to a table.
- Console game — hangman, tic-tac-toe, a quiz.
Common mistakes when learning Python
- Only watching lessons. Videos and textbooks without practice are forgotten within a week. Type out every topic yourself.
- Learning from outdated material. Examples with
print "x"are Python 2, which has long been unsupported. - Jumping straight into frameworks. Django without an understanding of functions and classes turns into copying other people's code.
- Being afraid of errors. A traceback is a hint, not a verdict. Read the last line.
- Running the wrong Python. One machine often has several versions; check with
python3 --version.
How to study effectively: textbook, lessons or course
All three formats work, as long as you combine them with practice. A textbook gives structure and depth, video lessons give visual explanations, and a course gives a ready route and feedback. The most common path to failure is reading or watching without ever opening an editor.
- Write the code yourself. Do not just copy examples: type them out and change them, and see what happens when you alter a condition or remove a line.
- Solve tasks every day. Five small practice exercises a day are more useful than one big dose of theory at the weekend.
- Keep a cheat sheet. Write down the commands and constructions you had to look up: string, list and dictionary methods, slice syntax, f-string formatting.
- Explain out loud. If you can describe in your own words how a loop or a dictionary works, you have understood the topic.
- Read other people's code. The standard library and small open-source projects show how experienced developers write Python.
When you have been stuck on a task for more than half an hour, write the question down: what you wanted to get, what you did and which error you see. Often the answer appears while you are formulating the question, and if it does not, such a question is easy to ask a mentor or in a community.
Summary
The plan for learning Python from scratch is simple: installation and your first script, syntax basics, collections, functions, errors and modules, files, classes — and only then frameworks. Reinforce each step with exercises and a running pet project, study regularly, and the basics fit into 2–3 months. Our Python course "Python 3.15: from beginner to pro" follows exactly this route in twelve lectures, with an expense tracker as the running project and "What's new" blocks for experienced developers.
FAQ
Can I learn Python on my own and for free?
Yes: the official documentation and tutorial on python.org are free, and you can solve tasks on practice platforms. The key is regular practice and your own project.
How long does it take to learn Python from scratch?
At 5–7 hours a week, the basics take 2–3 months; reaching the level needed for a first job usually takes at least six months of practice and projects.
Do I need maths to learn Python?
For basics, automation and web development, school arithmetic is enough. Serious maths is needed in data analysis and machine learning.
Should I choose Python or another language first?
Python suits most beginners thanks to its simple syntax and wide range of uses; the concepts you learn in it transfer easily to other languages.
Which code editor should a beginner choose?
For the first steps IDLE, which comes with Python, is enough; later VS Code with the Python extension or PyCharm Community is more convenient.
This topic is covered in depth with practice in the course “Python 3.15: от новичка до профи”.
Go to course