I have a task in which i need to calculate the runtime of a marathon. I'm given this as a start point
start_hour = 3
start_minute = 48
length = 172
Basically the start is at 3:48 and it continues for 172 minutes. My task is to find when the marathon ends.The endtime should look like this format 3:48 with minutes and hour converted to string and put together with ":". I have spent like 1 and a half hour and i still can't manage to solve it. This is what i have come out with:
endhour = start_hour + (length // 60)
endminute = start_minute + (length % 60)
end_minutee = endminute % 60
format(endhour)
endhourAsStr = str(endhour)
end_minuteeAsStr = str(end_minutee)
print(endhourAsStr + ":" + end_minuteeAsStr)
But when i print the final hour is shorter then it should be with 1 hour. I'm guessing that i need to do something with the > or < but i really can't figure it out.I guess that i only need that final push. offtopic: I'm very new to proggraming i don't have experience whatsoever.