Python for Beginners

Welcome

You have never written a program, and every course, job posting and tutorial seems to assume you have. This course starts at the blank file. You will install Python, type your first line, and build up, chapter by chapter, to a script that reads your files, remembers its data, talks to the internet, survives its own mistakes and comes with tests that prove it works.

≈7.5 hours to complete Knowledge check on every topic

About This Course

Python is the language this catalogue keeps pointing at. Machine learning is built on it, many backend services are written in it, and it is the tool people reach for when a task on a computer is dull enough to automate. This course teaches it from zero, to the point where you can write a useful program of a couple of hundred lines, maintain it, and read other people's Python without flinching.

It is a hands-on book. Every idea is explained in plain words first, and every program in it is one you type and run yourself. You will see a great many error messages along the way, on purpose, because learning to read them calmly is most of what separates a stuck beginner from a working programmer.

Who This Is For

Anyone who has never programmed and wants to start properly: career-switchers, students, analysts who are tired of doing the same spreadsheet by hand, testers and support engineers who keep meeting scripts, and readers of this catalogue's beginner books who reached the words "Python first" and wondered where to begin. If you can install an app and find a file in a folder, you have the background this course needs.

It is not a course about any one field. It does not teach web frameworks, databases or data-science libraries; those are the next books, and the last chapter points to them. It teaches the language itself, well enough that the next book reads easily.

What You Should Already Know

  • How to use a computer, a browser and everyday apps, at an ordinary user's level
  • How to find, create and rename files and folders in your file manager
  • No programming, and no command-line experience: the terminal is introduced from zero in Chapter 1
  • Arithmetic you already use for shopping and bills; no mathematics beyond that

How the Course Is Built

Twelve chapters in six movements. First contact (Chapters 1 and 2): what a program is, the terminal, installing Python, values and names. Control (Chapters 3 to 5): making decisions, repeating work with loops, and naming pieces of work as functions. Data (Chapters 6 and 7): dictionaries and their relatives, and reading and writing files. Failing well, and structure (Chapters 8 and 9): handling errors, splitting a program into modules, the standard library, and installing packages. The outside world (Chapter 10): saving data as JSON, requesting information from the internet, settings, and command-line arguments. Growing up (Chapters 11 and 12): classes, automated tests, the tools professionals use, and where to go next.

Every topic has the same shape: the problem it solves, the idea built step by step with code you can run, the mistakes people really make, why it matters, and a short knowledge check. Where a real example helps, it is a familiar one: your own spending, a bank statement, a trip abroad. Everything else uses the smallest example that makes the point.

Type it, run it, read it
Every program on these pages runs as shown, on Python 3.15. You learn by typing it, running it, and reading what comes back.
Errors are messages
Error messages appear from the first chapter, deliberately, and are read aloud in plain words. By the end, a traceback is information, not alarm.
Listen for the ideas, read for the syntax
The narration explains every program in words, so the ideas come through even with the screen off. The exact code lives on the page, ready to type.
Honest, never hyped
No "it's easy", no false simplicity. Where something is simplified, the page says so, and nothing here will need unlearning later.

Chapter Map

Chapter 1
What Programming Is
What a program really is, why Python, just enough terminal, installing Python, the interactive prompt, and your first program file, written, saved and run.
Chapter 2
Values and Names
Numbers, text and true-or-false; names that point at values; arithmetic and why money needs care; strings and f-strings; and asking the person at the keyboard a question.
Chapter 3
Making Decisions
Comparisons, if, elif and else, combining conditions, writing a rule with several cases cleanly, and reading an error message from the bottom up.
Chapter 4
Lists and Loops
Many values in order, changing a list, doing something to every item, loops that repeat until a condition changes, and answering questions about a list of numbers.
Chapter 5
Functions
Naming a piece of work, parameters and return values, where a name lives, and splitting a growing script into small functions with a main.
Chapter 6
Dictionaries and Friends
Looking things up by name, walking a dictionary safely, tuples and sets, lists of records, and the surprise of two names pointing at one list.
Chapter 7
Files
Reading text files, writing without destroying what was there, paths and the folder your program runs in, and reading a bank statement exported as CSV.
Chapter 8
When Things Go Wrong
Exceptions as messages, try and except done precisely, raising your own errors, handling bad data without crashing or hiding it, and debugging with a method.
Chapter 9
Modules, the Standard Library and Environments
One program in several files, the tools that ship with Python, dates and times, virtual environments, and installing packages safely with pip.
Chapter 10
Talking to the World
JSON as a program's memory, a request to a real web service, what to do when the network fails, settings and secrets outside the code, and command-line arguments.
Chapter 11
Objects and Classes
Objects you have been using all along, writing a simple class, dataclasses, and an honest rule for when a class helps and when a dictionary is enough.
Chapter 12
Tests, Tools and What Comes Next
Tests as promises you can run, your first pytest, reading one complete program end to end, the tools of the trade, and the books that come next.

Disclaimer

This course is an independent educational project created and maintained by Sergey Okinchuk. It is provided for learning and reference purposes only.

No affiliation. This course is not affiliated with, sponsored by, endorsed by, or officially connected to the Python Software Foundation or any other company, product, or organization. "Python" is a registered trademark of the Python Software Foundation.

Trademarks. Product and company names referenced are the property of their respective owners. Use of any name is for identification and educational purposes only and does not imply endorsement.

Educational simplifications. This material teaches durable concepts for understanding. Explanations are deliberately simplified for learning; where a simplification could mislead, the text flags it. This course is not professional, legal, or financial advice, and its spending examples are examples, not budgeting advice.

Accuracy and currency. Tools, installers and services change over time. Facts reflect the author's understanding at the time of writing, against Python 3.15. Always consult the official documentation at python.org for the current state of any tool.

No warranty. This material is provided "as is" without warranty of any kind. The author accepts no liability for any loss or damage arising from reliance on the content.