Checkpoint: the basics
Learn
On your own now
Four problems that use everything in Foundations: variables, arithmetic, strings, input, conversion and if. No starter code to lean on and no hints until you have checked once. Each problem is checked against several inputs, so a program that only works for the first one will not pass.
If one of them beats you, that is useful information: the result tells you which lesson to go back to.
Checkpoint
Seconds to a track length
Read a number of seconds and print it as minutes and seconds, the way a music app shows a track length: 207 becomes 3:27, 185 becomes 3:05. The seconds always have two digits.
Milestones
- 207 seconds
- 185 seconds
- Under a minute
- Exactly ten minutes
On your own: hints appear after your first check, a solution after 3 checks or if you give up.
Your program reads the Input box under the editor. Check also tries 3 other inputs.
Checkpoint
Check a new username
Read a username. Ignore spaces at either end. Then print the first message that applies:
No spaces allowedif there is a space inside itToo shortif it has fewer than 3 charactersToo longif it has more than 12- otherwise
OK:followed by the name in lower case
Milestones
- Spaces at the ends
- Space inside
- Two letters
- Seventeen letters
On your own: hints appear after your first check, a solution after 3 checks or if you give up.
Your program reads the Input box under the editor. Check also tries 3 other inputs.
CheckpointPredict the output
Trace the remainder
Type exactly what this prints.
Read the program, type exactly what it prints, then lock it in. It runs after that.
x = 7
y = x // 2
x = x % 2
if x == 1 and y > 2:
print("odd", y)
else:
print("even", y)
print(f"{x}{y}")
CheckpointFix the bug
Free delivery never applies
Orders of over 50 pounds get free delivery. The program crashes before it prints anything. Fix it.
Milestones
- Over 50
- Under 50
- Exactly 50
On your own: hints appear after your first check, a solution after 3 checks or if you give up.
Your program reads the Input box under the editor. Check also tries 2 other inputs.
total = input()
if total > 50:
print("Free delivery")
else:
print("Delivery: 4.99")
Cleared
Go back to
You can now
Save your progress to a free account
Next up: Core, with Premium
Loops, logic, lists, functions, dictionaries, tuples and sets, with a checkpoint after each group so you know it stuck.
- 08Repeating with while
- 09for loops and range()
- 10True, False and combining conditions
- 11Checkpoint: loops and logic
- 12Lists hold many things
- 13More list tools: split, join and friends
- 14Functions, and return vs print
- 15Parameters, defaults and scope
- 16Checkpoint: lists and functions
- 17Dictionaries map keys to values
- 18Tuples and sets
- 19Checkpoint: dicts, tuples and sets
Premium is £7.99 a month or £59 a year and opens every lesson after Foundations, in all four courses. What is included