Skip to content

Instantly share code, notes, and snippets.

Created April 6, 2015 13:38
Show Gist options
  • Save anonymous/f804d255631d099fbcee to your computer and use it in GitHub Desktop.
Save anonymous/f804d255631d099fbcee to your computer and use it in GitHub Desktop.
'''
Python 2.7
'''
timeDict = {}
with open("input.txt", "r") as file:
lineCounter = 0
for line in file:
lineCounter += 1
if lineCounter == 1:
continue
line = line.split(': ')
userName = line[0]
time = float(line[1].strip(' \n'))
timeDict[userName] = time
lastTimePressed = 0.0
while timeDict != {}:
minKey = min(timeDict, key=timeDict.get)
flair = 60 - timeDict[minKey] + lastTimePressed
print minKey, int(flair)
lastTimePressed = timeDict[minKey]
del timeDict[minKey]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment