Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

Evaluating the end time of a period of time

$
0
0

I am working on a simple code able to evaluate the end time of a period of time, given as a number of minutes (it could be arbitrarily large). The start time is given as a pair of hours (0..23) and minutes (0..59). The result has to be printed to the console.

For example, if an event starts at 12:17 and lasts 59 minutes, it will end at 13:16.

So far I tried below code and finding difficult to get hours calculation please help.

hour = int(input("Starting time (hours): "))mins = int(input("Starting time (minutes): "))dura = int(input("Event duration (minutes): "))mins = (mins + dura)%60hour = **** Please help this calculation ****print(hour, ":", mins, sep='')#expected output is 13:16 (ex: given hour = 12 , mins = 17 , dura = 59 )

Viewing all articles
Browse latest Browse all 14215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>