Skip to content

Instantly share code, notes, and snippets.

@hantuzun
Created March 15, 2015 13:12
Show Gist options
  • Save hantuzun/fe6db82b219a40c2c1a4 to your computer and use it in GitHub Desktop.
Save hantuzun/fe6db82b219a40c2c1a4 to your computer and use it in GitHub Desktop.
sum durations
durations = ['16:51', '21:00', '20:52', '13:46', '6:09', '12:01', '13:39', '9:04', '8:28', '11:58', '6:27', '6:15', '7:09', '16:11', '14:16', '13:20', '9:42']
mins = 0
secs = 0
for duration in durations:
mins += int(duration.rsplit(':', 1)[0])
secs += int(duration.rsplit(':', 1)[1])
mins += secs / 60
secs = secs % 60
print str(mins) + ':' + str(secs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment