I want to create a loop that prints:
"The train will leave at 13:36"
"The train will leave at 13:56"
"The train will leave at 14:16"
"The train will leave at 14:36"
"The train will leave at 14:56"
"The train will leave at 15:16"
etc. etc...
I have a code that says:
h = 13
m = 36
for i in range(5):
print("The train will leave at {}:{} ".format(h,m))
m = m + 20
if 60 <= m:
break
print("The train will leave at {}:{} ".format(h,m))
h = h+1
m = m-60+20
Output is:
The train will leave at 13:36
The train will leave at 13:56
The train will leave at 14:16
The train will leave at 14:36
The train will leave at 15:-4
The train will leave at 15:16
The train will leave at 16:-24
The train will leave at 16:-4
The train will leave at 17:-44
The train will leave at 17:-24
How can I fix it so minutes increments by 20 minutes and every time it reaches 60 minutes it should output the right time...