My program in hacker rank keeps on giving me IndexError: list index out of range for second_score = sorted(set([item[1] for item in nested_list]))[1] where as it runs perfectly for visula code. The code: if __name__ == '__main__': nested_list = [] for _ in range(int(input())): name = input() score = float(input()) nested_list.append([name,score]) nested_list.sort(key= lambda x:[x[1],x[0]]) second_score = sorted(set([item[1] for item in nested_list]))[1] list=[] for i in nested_list: if i[1] == second_score: list.append(i[0]) list.sort() for j in list: print(j) Continue reading...