📚 Python for beginners — Week 1
A class page with code, a PDF syllabus, a schedule and exercises.

Python for beginners 🐍
Week 1: variables, input and your first functions.

Course syllabus (PDF)PDF · 1 kBDownload
This week
Day | Topic | Homework |
|---|---|---|
Mon | Variables & types | Exercise 1 |
Wed | Input and | Exercise 2 |
Fri | Functions | Mini project |
Your first program
name = input("What is your name? ")
print(f"Hello, {name}! 👋")python
Run it with python3 hello.py in your terminal.
def average(numbers):
return sum(numbers) / len(numbers)
print(average([4, 8, 15, 16, 23, 42])) # 18.0python
Exercises
Exercise 1 — Temperature converter
Ask for a temperature in Celsius and print it in Fahrenheit (F = C × 9/5 + 32).
Exercise 2 — Tip calculator
Ask for the bill and the tip percentage; print the tip and the total.
Solution to Exercise 1 (no peeking!) 🙈
c = float(input("Celsius: "))
print(c * 9 / 5 + 32)python
Bring your laptop with Python 3.12 or newer installed.
Photo: Andrew Neel on Unsplash.