Skip to content

Instantly share code, notes, and snippets.

@shkesar
Created September 7, 2016 16:20
Show Gist options
  • Save shkesar/55346eb575877aec9d4a93d08fb98681 to your computer and use it in GitHub Desktop.
Save shkesar/55346eb575877aec9d4a93d08fb98681 to your computer and use it in GitHub Desktop.
Hacker rank problem
no = int(input())
students = []
for i in range(no):
name = str(raw_input("Enter name: "))
marks = float(raw_input("Enter marks: "))
students.append([name, marks])
smallest = min(students, key=lambda x: x[1])
def give_key(x):
if x[1] != smallest[1]:
x[1]
else:
9999
smallest2 = min(students, key=give_key)[1]
filtered_students = []
for student in students:
if student[1] == smallest2:
filtered_students.append(student)
filtered_students = sorted(filtered_students, key=lambda x: x[0])
print ""
for student in filtered_students:
print student
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment