I am sorry I didn't posted my code. I had solved this question long back on
hackerrank, and I couldn't figure out why this behaviour was seen in this
problem, so I had posted this question on their discussion forum. Couldn't
get a good answer so I decided to post here. Luckily I found the revision
history of my submission there where I could find the earlier code which
was giving this error.

Here is the code.

marks = [['Varun', 19.0], ['Kakunami', 19.0], ['Harsh', 20.0], ['Beria',
20.0], ['Vikas', 21.0]]
marks = sorted(marks, key=lambda score:score[1])
lowest = marks[0][1]

for row in marks:
    if row[1] == lowest:
        marks.remove(row)

second_lowest = marks[0][1]

sh = []
for row in marks:
    if second_lowest == row[1]:
        sh.append(row)

for row in sorted(sh):
    print row[0]
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to