Skip to content

Instantly share code, notes, and snippets.

@jossyboy2580
Forked from anonymous/gist:f804d255631d099fbcee
Last active August 29, 2015 14:18
Show Gist options
  • Save jossyboy2580/825aab04e349c747d3e1 to your computer and use it in GitHub Desktop.
Save jossyboy2580/825aab04e349c747d3e1 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