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 lines
first = 365, last = 420 and gap = 20. Check runs your program again with other timetablesPrints
6:05, 6:25, 6:45, then Buses: 3Formathours without a leading zero; minutes always two digits
Expected output4 lines
- 16:05
- 26:25
- 36:45
- 4Buses: 3