Module 2 · Check it yourself · challenge 1 of 2 in this lesson

A function formatClock(seconds) returns text such as Next drill in 8s

You compare your work with the list of what done means.

Open

Level 1, Apprentice

Challenge

Write a countdown formatter with string.format, math.ceil and math.max, and test it with 8, 7.2 and -3.

Start from
Any Run cell in this lesson

Done means

  • A function formatClock(seconds) returns text such as Next drill in 8s
  • It rounds up: 7.2 seconds shows as 8s
  • It never shows a negative number: -3 shows as 0s

Meet the criteria above, then record your own result. No test grades this check.