Last active
March 14, 2018 23:57
-
-
Save warrickct/078ea6ffb3830b52e2265f7d88d55f08 to your computer and use it in GitHub Desktop.
Simple script to add time in hours:mins format iteratively to get total hours.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
totalHours = 0 | |
totalMins = 0 | |
while 1==1: | |
addTime = input("enter time: ") | |
addTime = addTime.split(':') | |
addHours = int(addTime[0]) | |
addMinutes = int(addTime[1]) | |
totalMins += addMinutes | |
if totalMins > 60: | |
totalHours+= 1 | |
totalMins = totalMins%60 | |
totalHours+= addHours | |
print("New total time: ", totalHours, ":", totalMins) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment