Skip to content

Checkpoint: Getting started

4 min readCheckpoint

You've finished the first module. This checkpoint pulls it together: a few quick questions, a program to read, a program to repair, and one to write from scratch. No new ideas here, only practice. If something feels shaky, the lesson it came from is linked in the course map, and going back is part of learning, not a failure.

What you know now

In five lessons you went from "what is a programming language" to writing, running, and fixing real programs. Here's the short version.

A program is a list of exact instructions. Python is an language: it reads your code from the top and runs each line in turn. You run it in one of two ways: the interactive shell, which answers one line at a time, or a script, a .py file that runs from top to bottom.

print shows values on the screen. Text goes in quotes; numbers don't, and Python can do arithmetic with them. Commas give print several values, separated by spaces; sep changes what goes between them and end what comes after.

Comments start with # and are ignored by Python. Spaces at the start of a line matter. And when something breaks, the last line of the error tells you what kind of problem it is.

If any of that sounds unfamiliar, here's where each idea lives:

  • Programs, programming languages, and "interpreted": lesson 0.1, What is Python?
  • Installing Python and the terminal: lesson 0.2.
  • print, sep, end, and your first errors: lesson 0.3, Your first program.
  • The shell versus scripts: lesson 0.4, Two ways to run Python.
  • Comments, indentation, and PEP 8: lesson 0.5.

Answer these without scrolling back. Pick an answer even if you're not sure; the feedback will tell you why. Getting one wrong here costs nothing, and it tells you exactly which lesson is worth a second look.

Quick check

What does print("Birr", 250, sep="") show?

Quick check

In a script, what does a line containing only 10 * 3 show?

Quick check

You typed python3 --version inside the Python shell and got a NameError. What went wrong?

Quick check

Which error does print("Hi) cause?

Read before you run

Reading code carefully, and predicting what it does, is most of programming. Before you run anything, you should be able to say what it will print, at least roughly. When the real output surprises you, that surprise is worth stopping for: it means your picture of how Python works needs one small fix.

This one mixes end settings. Work it out line by line, keeping track of where the cursor is after each print.

What will this print?

Decide before you look. Guessing wrong is how this sticks.

print("Loading", end="")
print("...", end=" ")
print("done")
Pick the output

Python prints

Loading... done

The first print ends with nothing, so ... follows straight after Loading. The second ends with a space instead of a new line, so done comes after that space.

Fix the program

This program should print three lines about a coffee shop, but it has three mistakes. Run it, read the last line of the error, fix that one thing, and run it again. Repeat until it prints this:

Output
Selam Coffee
Open every day
Bole Road, Addis Ababa
print("Selam Coffee)
prnt("Open every day")
  print("Bole Road, Addis Ababa")

In the editor, press Escape then Tab to move on.

Notice the order Python reported them in. The missing quote and the stray indent both came before the misspelled prnt, even though prnt is on line 2. Python first checks that the whole file follows its grammar, and only then starts running lines. Grammar mistakes (SyntaxError, IndentationError) stop everything; a NameError only appears when Python reaches that line.

If you got stuck, the three fixes were: close the quote after Selam Coffee, correct prnt to print, and remove the spaces in front of the last line so it starts at the edge like the others.

Now build something from nothing. A good way to write any program, however small, is one line at a time: write the first line, run it, compare it with what you want, then add the next. You'll catch mistakes while they're small and easy to find.

Exercise

Print a café receipt

Write a program that prints this receipt exactly. Work out the total with + instead of typing 95 yourself, and add a comment at the top saying what the program is for. The note under the code box tells you when your output matches.

Output
Selam Coffee
------------
Macchiato 45 birr
Sambusa 30 birr
Water 20 birr
------------
Total: 95 birr
Thank you, come again!

receipt.py

# Receipt for one order at Selam Coffee

In the editor, press Escape then Tab to move on.

Show a solution

This is one way to solve it, not the only one. If yours prints the same thing, it works.

# Receipt for one order at Selam Coffee
print("Selam Coffee")
print("------------")
print("Macchiato", 45, "birr")
print("Sambusa", 30, "birr")
print("Water", 20, "birr")
print("------------")
print("Total:", 45 + 30 + 20, "birr")
print("Thank you, come again!")

When your receipt matches, you've finished the Shallows' first module. Next comes Module 1, where you'll give names to values, so that 45 can become macchiato_price and a receipt can add itself up.

Key takeaways

  • Python checks the whole file's grammar first; SyntaxError and IndentationError stop it before any line runs.
  • A NameError appears only when Python reaches the line with the unknown name.
  • Fix one error at a time, starting with the one Python reports.
  • print, sep, end, comments, and arithmetic are enough to build real, useful output.

That's the end of the free lessons in this part. The rest of the course is in Telegram.

The full Python course

You enroll in Telegram. Pay with Telebirr or CBE, and the bot adds you to the course within minutes.

What's included

  • Every video lesson with detailed step-by-step walkthroughs
  • All projects with complete, documented reference solutions
  • Private Telegram community group with direct peer discussions
  • Direct Q&A help and code reviews from the instructor