Skip to content
APEX FLOWACADEMY
MENU
Technology / beginner

Python From Zero: Write Programs That Work

Learn Python 3 by building three small tools that really run: a budget tracker, a file organiser and a quiz game.

24 lessons6 modulesabout 8 hours10 workbook itemsbeginner
READ LESSON 1 FREE

One payment of $39. Instant online access to the full written course. No subscription. Refund policy.

What you will be able to do

You write and run real Python programs from the first lesson, and you finish with three small working tools that you built yourself, tested with checks you wrote, and can change without starting over.

Who it is for. Complete beginners who have never written code, and anyone who has tried before and got stuck. You should be able to install a program, save a file and open a folder on your computer.

You finish with. Three Small Programs: Budget Tracker, File Organiser and Quiz Game. You finish with three programs, each built up step by step across the modules and assembled in the last one. The budget tracker lets you add, list and summarise expenses and remembers them between runs. The file organiser sorts the loose files in a folder into type folders, shows a plan first, and never deletes or overwrites anything. The quiz game shuffles questions from a file you can edit, gives points for fewer tries and keeps a high score. A checker script imports all three and tests their functions.

Certificate. Finish every lesson, resolve every quiz question with at least 50% right on the first try, and tick the capstone checklist — Apex Flow Academy issues a verifiable Certificate of Completion with a unique ID and a public verification page. It is a certificate of completion, not a degree, licence, accreditation or exam result.

The path, module by module24 lessons
01 · Your First Working Programs4 lessons

Install Python, run a file from the terminal, store values in variables, do arithmetic, turn typed text into numbers and build tidy sentences with f-strings. You finish by writing the first piece of your budget tracker.

  1. 1.1Run Your First Python ProgramFREE
  2. 1.2Variables and Input: Store What You Type
  3. 1.3Numbers: Do the Maths and Convert Typed Text
  4. 1.4Text and f-strings: Build Clear Sentences
02 · Decisions and Repetition4 lessons

Teach your programs to choose and to repeat. You learn comparisons, if, elif and else, while loops and for loops, then use them to build the first piece of your quiz game: one question with three tries and points for answering early.

  1. 2.1True or False: Comparing Values
  2. 2.2Make Choices with if, elif and else
  3. 2.3Repeat Until Ready with while
  4. 2.4Repeat a Set Number of Times with for and range
03 · Collections: Lists, Dictionaries and Records4 lessons

Real programs handle many values at once. You learn lists, looping over lists to summarise them, dictionaries for lookups and counting, and lists of dictionaries for records. Your budget tracker grows into a real report, and your file organiser gets its first piece.

  1. 3.1Lists: Many Values in One Place
  2. 3.2Loop Over a List and Summarise It
  3. 3.3Dictionaries: Look Things Up by Name
  4. 3.4Records: A List of Dictionaries
04 · Functions and Modules: Reusable Building Blocks4 lessons

Stop copying code. You learn to write functions, return results, use Python's ready-made modules such as random and datetime, and check your functions with assert. Your quiz game gets its real structure, and your budget tracker is rebuilt from small tested pieces.

  1. 4.1Write Your Own Function
  2. 4.2Return a Value and Use Defaults
  3. 4.3Modules: Import Ready-Made Tools
  4. 4.4Check Your Functions with assert
05 · Errors, Files and Folders4 lessons

Real programs meet bad input, missing files and data that must survive between runs. You learn to read a traceback and handle errors with try and except, read and write text files, save data as JSON, and list and move files with pathlib and shutil. Your budget tracker learns to save, and your file organiser touches real files.

  1. 5.1When Things Go Wrong: Read a Traceback and Use try and except
  2. 5.2Read and Write Text Files
  3. 5.3Save Data with JSON
  4. 5.4Work with Folders: pathlib and shutil
06 · Assemble: Three Programs That Work4 lessons

Turn the pieces from five modules into three finished programs. You learn to give a file a main function and a safe import guard, to build menus that keep a program running, and to debug with a repeatable method. Then you assemble the budget tracker, the quiz game and the file organiser, and prove them with a checker script.

  1. 6.1Give Every Program a main() and Make Files Safe to Import
  2. 6.2Menus: Keep the Program Running Until the User Quits
  3. 6.3Debugging: A Repeatable Way to Find Bugs
  4. 6.4Capstone: Assemble and Check Your Three Programs
Free preview · lesson 1.1No sign-up
Free lesson · 1.1

Run Your First Python Program

About 6 minStep 1 of 7 · You will be able toNo sign-up
Step 1 of 71 min read

You will be able to

  • Run a Python file from a terminal.
  • Show text and answers on screen with print.
  • Read the last line of an error message.
Step 2 of 71 min read

Why this matters

A program is a list of instructions saved in a text file. Python is the tool that reads the file and follows the instructions, one line at a time. Everything in this course starts with the same loop: write a file, run it, read what happened. By the end you will have built three small programs: a budget tracker, a file organiser and a quiz game. Each module ends with a project that adds one piece to them, so the last module is assembly, not a surprise.

Step 3 of 72 min read

Learn it

How to use this course. Type every example yourself, run it, and compare your result with the output shown under it. Then do the task at the end of the lesson. Typing feels slow, but it is how your eyes and fingers learn where the quotes and colons go.

Get Python. Python is free. Download the current Python 3 from the official site, python.org/downloads, and run the installer. Windows now uses a small tool called the Python install manager, Macs use a .pkg installer, and most Linux systems already include Python 3. This course was tested on Python 3.10 to 3.13. A newer version should behave the same, and the last line of any error message will still tell you the problem. If the download page looks different from this description, follow the steps it shows for your system.

Now set up your workspace:

  1. Open a terminal, a window where you type commands. On Windows, search for Terminal or PowerShell. On a Mac, open the Terminal app.
  2. Check Python: type python --version and press Enter. On a Mac or Linux, type python3 --version. You should see a number that starts with 3.
  3. Make a folder for the course: mkdir python_toolbox. Move into it with cd python_toolbox. The command cd means "change directory", and a directory is just a folder.
  4. In a plain text editor, create a file named hello.py inside that folder. IDLE, Visual Studio Code and Notepad all work. Do not use a word processor. Check each tool's website for its current features and price.
  5. Type the program below and save it.
  6. Run it with python hello.py. On a Mac or Linux, run python3 hello.py.

Python reads your file from the top and does each line in order. The word print is a function, a ready-made tool with a name. The brackets hold what you hand to the tool. Text inside quotes is called a string, and print shows a string exactly as written.

Step 4 of 71 min read

See it in action

Type this into hello.py. The first line starts with #, which tells Python to ignore that line. It is a note for people, called a comment. Every example in this course starts with a comment that names the file to save it as.

Pythonhello.py
Output
Hello from Python!
My name is Sam.
2 + 3
5

The line print("2 + 3") has quotes, so Python prints the characters as they are. The last line has no quotes, so Python works out 2 + 3 and prints the answer.

Now break something on purpose, so that an error does not scare you later. Save this as broken.py and run it:

Pythonbroken.py
Output
  File "broken.py", line 2
    print("Hello)
          ^
SyntaxError: unterminated string literal (detected at line 2)

Python names the file and line, points at the spot, and describes the problem on the last line. Read that last line first. Here the closing quote is missing. Your wording may differ a little between Python versions.

Step 5 of 71 min read

Common mistakes

  • Saving as hello.py.txt. Windows can hide file endings, so the name looks right but is not. Turn on file name extensions in File Explorer, or use Save As with the type set to All files.
  • Running the command in the wrong folder. Python says it cannot open the file. Use cd to move into python_toolbox and try again.
  • Curly quotes. Word processors swap plain quotes for curly ones, and Python rejects them. Use a plain text editor.
  • Typing python on its own. That opens an interactive prompt that shows >>>. Type exit() and press Enter to leave it.
Step 6 of 71 min read

You are done when

You have run hello.py and seen four lines of output. You have also run broken.py, watched it fail, and found the missing quote from the last line of the message.

If this is not working

  • Windows says python is not recognised, or opens the Microsoft Store: try py hello.py. If that fails, install Python from python.org and open a new terminal window. The official Windows page also describes a setting called app execution aliases.
  • Mac or Linux says python is not found: type python3 instead.
  • Nothing new appears: save the file in your editor, then run it again.
  • The message says no such file: you are in the wrong folder. Use cd again.
Step 7 of 7

You finished the free lesson

That is one lesson from the course. The full course gives you every remaining lesson, a quick check and a hands-on task in each one, and the workbook of templates and checklists.

Full course$39

What you need
  • A Windows, macOS or Linux computer where you can install software, or one that already has Python 3.
  • Python 3, free from python.org. The examples were tested on Python 3.10 to 3.13.
  • A plain text editor. IDLE (which comes with most Python installs), Visual Studio Code (free) and Notepad all work. Check each tool's website for current features and pricing.
  • A terminal window. It is built into your computer: Terminal or PowerShell on Windows, Terminal on a Mac.
  • Nothing in this course requires a paid tool or subscription.
Before you start
  • No programming experience is needed.
  • You can install a program, save a file and open a folder on your computer.
  • You are comfortable with everyday arithmetic such as adding, multiplying and dividing.
The capstone

Three Small Programs: Budget Tracker, File Organiser and Quiz Game

You finish with three programs, each built up step by step across the modules and assembled in the last one. The budget tracker lets you add, list and summarise expenses and remembers them between runs. The file organiser sorts the loose files in a folder into type folders, shows a plan first, and never deletes or overwrites anything. The quiz game shuffles questions from a file you can edit, gives points for fewer tries and keeps a high score. A checker script imports all three and tests their functions.

  • budget_tracker.py: a menu program that adds, lists and summarises expenses, validates dates and amounts, saves to expenses.json and warns when the total passes a limit you set
  • file_organiser.py: a program that plans moves for the loose files in a folder, shows the plan, moves files only after you type yes, adds a number to a clashing name and skips its own file
  • quiz_game.py: a program that loads questions from questions.json, shuffles them, allows three tries per question, rejects invalid letters, and keeps a high score between runs
  • capstone_check.py: a script that imports the three programs and prints three lines showing that their checks passed
  • One feature of your own added to one of the programs, with a check that proves it works
Key terms taught24
program
A list of instructions saved in a text file that Python follows from top to bottom.
terminal
A window where you type commands to your computer instead of clicking.
directory
Another word for a folder.
function
A named set of steps that you can run again and again. print is a function that comes with Python, and you can make your own.
string
A piece of text in quotes, such as "Hello".
comment
A note for people that starts with # and is ignored by Python.
variable
A name that points to a value, so you can use the value again and change it later.
int and float
An int is a whole number such as 3. A float is a number with a decimal point such as 3.5.
boolean
A value that is either True or False, such as the answer to 5 > 3.
tuple
A group of values in round brackets that cannot be changed, such as ("a", "b").
loop
A way to repeat the same lines of code. A while loop repeats as long as a condition is true, and a for loop repeats once for each value.
list
Many values kept in order under one name, written in square brackets.

Browse the full Academy encyclopedia

How this course was checked

16 checks were run and recorded while writing this course (code, formulas, commands and facts), and it lists 19 official sources it was checked against. Prices, features and policies of outside tools can change, so check each tool's own website.

Created by Apex Flow Academy with AI assistance. For education only; not legal, tax, financial or medical advice. Results depend on your effort and circumstances.