Skip to content

Instantly share code, notes, and snippets.

@mdippery
Created April 8, 2014 18:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mdippery/10163960 to your computer and use it in GitHub Desktop.
actual = [['0:00.762', '0:01.435'], ['2:01.374', '2:07.423'], ['3:01.412', '3:07.314']]
expected = [['0.762', '1.435'], ['121.374', '127.423'], ['181.412', '187.314']]
def convert(s):
mins, secs = s.split(':')
mins = int(mins)
secs = float(secs)
secs = 60 * mins + secs
return secs
def convert_pair(p):
p0, p1 = convert(p[0]), convert(p[1])
return [str(p0), str(p1)]
times = map(convert_pair, actual)
print times
print times == expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment