Skip to content

Instantly share code, notes, and snippets.

@jdkato
Last active December 22, 2016 17:36
Show Gist options
  • Save jdkato/e2b5fabe2daf795e2438469c944d4409 to your computer and use it in GitHub Desktop.
Save jdkato/e2b5fabe2daf795e2438469c944d4409 to your computer and use it in GitHub Desktop.
import datetime
done = False
count = 0
times = []
splits = []
while not done:
split = input('split: ')
if split == '':
done = True
continue
try:
dt = datetime.datetime.strptime(split, '%M:%S.%f')
except:
print('Try again!')
continue
split = 60 * dt.minute + (dt.second + (dt.microsecond / 1000000.0))
times.append(split)
if count != 0:
split = split - times[count - 1]
splits.append(round(split, 2))
count += 1
splits.append(round(sum(splits), 2))
print(str(splits).strip('[]').replace(' ', '') + ',')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment