Chapter 1 · Lesson 2 of 5
02. One line after another
Programs run from top to bottom. Print several lines, and let Python do some maths for you.
Python follows your instructions in order, from the first line to the last. Each print shows its own line.
print("Ready")print("Steady")print("Go!")It shows
Ready Steady Go!
Numbers don't need quotes. Without quotes, Python works the sum out first and prints the answer. With quotes, it's just text, so it prints exactly what's there.
print(7 + 5)print("7 + 5")It shows
12 7 + 5
Your turn
1Steps
- 1Print three lines:
Python can count!, then the answer to365 * 24worked out by Python, thenDone.
Starting code
The editor starts empty. Copy this into it to begin, or write your own from scratch.
print("Python can count!")2Expected output
It should show
Python can count! 8760 Done.
3Hints
Stuck? Open one hint at a time: each gives a bit more help.
Hint 1
You need three print lines, one under the other.
Hint 2
For the middle line, put the sum itself inside print, without quotes, so Python works it out.
Hint 3
The second line is print(365 * 24), and the third is print("Done.")