What is Python?
Here are three small Python programs. You don't need to understand them yet; that comes over the next few modules. By the end of Module 3 you'll write programs like these yourself. By the end of this lesson you'll know what a programming language is, what Python is used for, and what this course will take you through.
Three small programs
The first one splits a café bill between friends. Before you run it, guess what it prints. Pick the line you think is right.
What will this print?
Decide before you look. Guessing wrong is how this sticks.
total = 1275
people = 4
share = total / people
print("Each person pays", share, "birr")Python prints
Each person pays 318.75 birr
Python works out 1275 / 4 and shows the result, 318.75. It never prints the word share itself: without quotes, share is a name for a value, and Python shows the value.
Now run it, then change people = 4 to people = 5 and run it again.
total = 1275
people = 4
share = total / people
print("Each person pays", share, "birr")In the editor, press Escape then Tab to move on.
The second is a guessing game. It asks for guesses until you find the secret number. In these code boxes, answers to questions go in the Input box, one per line. This one already has three guesses there: 3, 9, and 7.
secret = 7
guess = int(input("Guess a number from 1 to 10: "))
while guess != secret:
print("Not that one. Try again.")
guess = int(input("Guess: "))
print("Yes! It was", secret)In the editor, press Escape then Tab to move on.
One answer per line, given to input() in order.
The third turns an exam score into a grade. Change 78 to your own score and run it.
score = 78
if score >= 85:
print("Grade: A")
elif score >= 70:
print("Grade: B")
else:
print("Grade: C")In the editor, press Escape then Tab to move on.
Each program is a handful of lines, and each one does something useful. That's the point of this course: short, real programs from the first module on.
What a programming language is
A computer follows instructions exactly, like a cook following a recipe to the letter. If the recipe says "add 5 spoons of salt" when it meant 5 grams, the cook adds 5 spoons. A computer is the same, only faster and even more literal: it never guesses what you meant.
A list of instructions for a computer is a . You can't write one in Amharic or English, because everyday language is full of guesses and shortcuts. Instead you use a : small and strict enough for a computer to follow, but still readable by people. Python is one of them.
Quick check
What does a programming language let you do?
Python reads one line at a time
Python is : a program called the Python interpreter reads your code from the top and carries out each line as it gets there. The third line below has a typo. Decide what you'll see before you reveal it.
What will this print?
Decide before you look. Guessing wrong is how this sticks.
print("one")
print("two")
prnt("three")Python prints
one
two
Traceback (most recent call last):
File "<your code>", line 3, in <module>
prnt("three")
^^^^
NameError: name 'prnt' is not defined. Did you mean: 'print'?Python ran lines 1 and 2 before it reached the typo on line 3. Only then did it stop. Look at the last line of the error: it names the problem and even suggests the fix. Reading the last line first is a habit you'll use every day.
An error isn't a sign you've failed. It's Python telling you exactly where it got stuck. You'll see many, and each one teaches you something.
What Python is used for
Python is one of the most used programming languages in the world, in very different kinds of work:
- Websites and apps. Instagram's backend, the code that answers when you open the app, is built with Python and its web framework Django.
- AI. Most AI tools are built and trained with Python libraries such as PyTorch.
- Data analysis. Cleaning spreadsheets, comparing exam results, drawing charts, once a job gets too big for Excel.
- Automation. Short scripts that rename a thousand photos, send reminders, or check prices every morning.
Why learn to code if AI writes code?
AI tools can write a lot of code now, and you'll use them. But AI code is often wrong in small ways, and someone has to read it, check it, and fix it. You can't judge code you can't read. This course teaches you to read and reason about code, which is what makes AI useful to you instead of a guess you have to trust.
What this course is
Every lesson on this website is free, and every code box runs Python right in your browser. The course starts in the Shallows, where you are now, and goes down through Currents and Deep Water to Landfall.
Along the way you'll build one project that grows with you: Birr Ledger, an expense tracker. It starts as a few lines that add up what you spent on coffee and taxis, and ends as a real, typed, tested Python package, ready to become a web API in the FastAPI course. The course page shows the whole map.
Key takeaways
- A program is a list of exact instructions; a programming language is how you write them. The computer never guesses what you meant.
- Python is interpreted: it runs your code one line at a time, from the top.
- When Python stops with an error, read the last line first.
- Python runs websites, AI tools, data analysis, and automation.
- You'll read code before you write it, which is also how you check code an AI wrote.