#546 · Python Basics · Beginner · 30 XP · about 4 min
Write to_clock(minutes) that turns a number of minutes into a string written like a clock: the hours, a colon, then the minutes that are left over.
The minutes part always has two digits, so 5 minutes is written 05. The hours part has as many digits as it needs.
to_clock(135) # returns '2:15' to_clock(65) # returns '1:05' to_clock(45) # returns '0:45' to_clock(600) # returns '10:00'
135 minutes is 2 whole hours (120 minutes) with 15 minutes left over.
minutes is a whole number from 0 to 10000.
First solves only, ranked by stars and then time.