+ 1

Nested list

Hackerrank Question link : https://www.hackerrank.com/challenges/nested-list/problem this is my solution n = int(input()) record = [] gradeArr = [] for _ in range(n): name = input() grade = float(input()) record.append([name,grade]) gradeArr.append(grade) # record.sort() # print(record) smallestGrade = min(gradeArr) # print(smallestGrade) count = gradeArr.count(smallestGrade) if count>1: index = [i for i in range(len(gradeArr)) if gradeArr[i] == smallestGrade] index.reverse() for i in index: record.remove(record[i]) gradeArr.remove(gradeArr[i]) else: index = gradeArr.index(smallestGrade) record.remove(record[index]) gradeArr.remove(gradeArr[index]) scndLowestGrade = min(gradeArr) # print(scndLowestGrade) lst = [] countGrade = gradeArr.count(scndLowestGrade) if countGrade>1: index = [i for i in range(len(gradeArr)) if gradeArr[i] == scndLowestGrade] for i in index: lst.append(record[i][0]) lst.sort() print() for i in lst: print(i) else: index = gradeArr.index(scndLowestGrade) print() print(record[index][0]) ( I have written it in Jupyter notebook. There, when I am checking test cases it's working properly But on hackerrank Its giving runtime error every time. could anyone of you tell me why it is so? )

12th Jun 2020, 12:24 PM
Anjali Singh
Anjali Singh - avatar
4 odpowiedzi
12th Jun 2020, 12:30 PM
Anjali Singh
Anjali Singh - avatar
+ 1
Ok thankyou 😊
12th Jun 2020, 2:46 PM
Anjali Singh
Anjali Singh - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 I fixed it bt still the same problem is occuring , #runtime error
12th Jun 2020, 2:35 PM
Anjali Singh
Anjali Singh - avatar
0
Thanks if it has passed all the test cases.😊 Bt is it a browser problem?😐
12th Jun 2020, 2:42 PM
Anjali Singh
Anjali Singh - avatar