Skip to content

fix incorrect solution for the "Nested Lists" HackerRank problem #5

Description

@bastitva0-blip

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions