The current solution for the Nested Lists HackerRank problem does not produce the correct output in all cases as it has syntax error:
I'd be happy to submit a pull request with the fix if contributions are welcome
the correct code looks like:
n = int(input())
students = []
for _ in range(n):
name = input()
score = float(input())
students.append([name, score])
scores = sorted(set(score for name, score in students))
second_lowest = scores[1]
answer = sorted(name for name, score in students if score == second_lowest)
for name in answer:
print(name)
The current solution for the Nested Lists HackerRank problem does not produce the correct output in all cases as it has syntax error:
I'd be happy to submit a pull request with the fix if contributions are welcome
the correct code looks like:
n = int(input())
students = []
for _ in range(n):
name = input()
score = float(input())
students.append([name, score])
scores = sorted(set(score for name, score in students))
second_lowest = scores[1]
answer = sorted(name for name, score in students if score == second_lowest)
for name in answer:
print(name)