Skip to content

Instantly share code, notes, and snippets.

@warrickct
Last active March 14, 2018 23:57
Show Gist options
  • Save warrickct/078ea6ffb3830b52e2265f7d88d55f08 to your computer and use it in GitHub Desktop.
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.
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