Pathwise

Technology and code · 12 Lessons

Intro to Python

Your first real programs, from one line that prints a number to a small tool that reads a file, with an animated diagram in every lesson showing what the code actually does.

For absolute beginners who have never written a line of code. You learn Python one idea at a time: values and variables, text, input, decisions, lists, loops, functions, dictionaries, error messages and files. Every lesson has short, real code examples with the output they print, and an animated diagram you step through that shows what happens inside: variables as labelled boxes, a loop stepping along a list, a function call stacking up and returning. The last lesson puts it all together in a small expense tracker that reads a file and prints a report.

By the end you can

First steps

What a program is and how Python runs it, then the two things every program is made of: values, and names that hold them. Text gets its own lesson, because you will use it everywhere.

  1. Your first program

    A program is a list of instructions Python runs from top to bottom. Write your first lines with print, and use Python as a calculator that knows the order of operations.

  2. Variables: names for values

    A variable is a name that points at a value so you can use it later. Learn how = stores a value, how to change it, and why changing one variable doesn't quietly update another.

  3. Strings: working with text

    Text in Python is a string, a row of characters in quotes. Join strings, measure them, pick out characters by position, and build sentences with f-strings.

Input, decisions and lists

Ask the user for something and turn their answer into a number, let the program choose what to do with if, and keep many values together in one list.

  1. Input and types

    input() lets your program ask a question, but the answer always comes back as text. Learn the main types and how to convert between them, so "7" + "3" stops giving you 73.

  2. Making decisions with if

    Comparisons give True or False, and if, elif and else use them to choose which lines run. Learn why indentation matters and why the order of your tests changes the answer.

  3. Lists: many values in one place

    A list keeps values in order under one name. Get items by position, add and change them, and learn the error you get when you ask for a position that isn't there.

Repeat, reuse, look up

Loops that do the same thing for every item, functions that give a name to a job you do often, and dictionaries that find a value by its key.

  1. Loops: doing it again

    A for loop runs the same lines once for every item in a list or a range. Add things up with a running total, count with range, and use while when you don't know how many times in advance.

  2. Functions: name a job, reuse it

    A function packages steps under a name so you can run them whenever you need. Pass in values as parameters, send a result back with return, and see what happens on the call stack when one function calls another.

  3. Dictionaries: look it up by name

    A dictionary stores pairs of key and value, so you find things by a name instead of a position. Add and update entries, loop over them, and avoid the KeyError with get.

Real programs

Reading an error message instead of fearing it, saving and loading data with files, and a small final project that uses everything in the course.

  1. Reading error messages

    An error message is Python telling you where it stopped and why. Read a traceback from the bottom up, recognise the six errors beginners meet most, and catch one you expect with try and except.

  2. Saving and reading files

    Variables disappear when the program ends; files stay. Open a file with with, write lines to it, add to it without wiping it, and read it back line by line.

  3. Final project: an expense tracker

    Put the whole course together in one small program: read your expenses from a file, add them up by category in a dictionary, and print a report, built one working step at a time.

Keep it, don't just read it

Pathwise brings each idea back just before you'd forget it, with a quick question. Free on Android and on the web, in English and Persian.

Cafe Bazaar Myket Open the web app