runtime
47 / 500
question 47 Loops & Iteration · medium

Print a bus timetable

A timetable stores times as minutes after midnight: 365 is 6:05. A bus leaves at first, then every gap minutes, and the last one leaves no later than last. Print each departure as hours, a colon and two-digit minutes (6:05, 14:30), then how many buses run.

First linesfirst = 365, last = 420 and gap = 20. Check runs your program again with other timetables
Prints6:05, 6:25, 6:45, then Buses: 3
Formathours without a leading zero; minutes always two digits
Expected output4 lines
  1. 16:05
  2. 26:25
  3. 36:45
  4. 4Buses: 3

Loading your progress…

Print a bus timetable — Python practice · Runtime