M1 solution
The expected, fully-commented artifacts for M1's lab. Peek only after you've tried the lab: the win is writing it yourself.
| File | What it is |
|---|---|
hello.py |
Steps 2-8 in one place: print, comments, variables, the three types, an f-string. |
greeter.py |
The Step 9 build, fully commented line by line: input → convert to number → maths → personalized f-string output. |
Run it
In Google Colab (today's way): open the file, copy its contents into a cell, press ▶ Run.
When greeter.py asks questions, type your answers in the box that appears.
On your own computer (from M3 onward, once Python is installed):
python greeter.py
How this was verified
Both files were run with Python 3 before shipping. greeter.py was run with the answers
Alex / 42.50 / 18 and produced:
Thanks, Alex! Here's your bill:
Bill: $42.50
Tip: $7.65 (18%)
Total: $50.15
You wrote a real program, Alex.
hello.py produced:
Hello, World!
Hi, I'm Ada. I'm 36. Learning Python: True.