Created
April 6, 2015 13:38
-
-
Save anonymous/f804d255631d099fbcee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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