Skip to content

Instantly share code, notes, and snippets.

@artursapek
Created January 31, 2012 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artursapek/1708801 to your computer and use it in GitHub Desktop.
Save artursapek/1708801 to your computer and use it in GitHub Desktop.
earliestTime(x)
def earliestTime(x):
conv = {}
for t in x:
a, b = t[:t.find('m')-1].split(':') if ':' in t else (t[:t.find('m')-1], 0)
conv[(int(a) * 60) + int(b) - (720 if 'am' in t else 0)] = t
return conv[min(conv.keys())].strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment