Nested Lists Hackerrank Solution Python
For Explanation Watch Video:
Sample Input 0
5
Harry
37.21
Berry
37.21
Tina
37.2
Akriti
41
Harsh
39
Sample Output 0
Berry
Harry
Code:
if __name__ == '__main__': emptyDict = {} def add(key, value): emptyDict[key] = value for _ in range(int(input())): name = input() score = float(input()) add(name,score) v = emptyDict.values() second = (sorted(list((set(v))))[1]) second_lowest = [] for key,value in emptyDict.items(): if value==second: second_lowest.append(key) second_lowest.sort() for name in second_lowest: print(name)
Comments
Post a Comment