Skip to content

Instantly share code, notes, and snippets.

@spellancer
Last active December 24, 2015 19:39
Show Gist options
  • Save spellancer/6852084 to your computer and use it in GitHub Desktop.
Save spellancer/6852084 to your computer and use it in GitHub Desktop.
fr = open('input.txt','r')
fw = open('output.txt','w')
line = fr.readline()
a = []
i=0
while len(line)!=0:
line = fr.readline()
i+=1
line = line.split()
if len(line)!=0:
line[2]=line[2].split('%')[0]
a.append([i,float(line[2]),float(line[5]),float(line[8])])
a.sort (key=lambda x:([1],x[3],x[2]), reverse=True)
fw.write (str(a[0][0]))
fr.close()
fw.close()
@Kanst
Copy link

Kanst commented Oct 6, 2013

while True:
line = fr.readline()
if not line:
break
line = line.split()
print line

@Kanst
Copy link

Kanst commented Oct 6, 2013

a.sort (key=lambda x:(!!!x!!!!!!![1],x[3],x[2]), reverse=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment