We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Basic Data Types
- Nested Lists
- Discussions
Nested Lists
Nested Lists
Sort by
recency
|
4428 Discussions
|
Please Login in order to post a comment
This is my solution:
if name == 'main': lst = [] xm = int(input()) for x in range(xm): name = input() score = float(input()) lst.append([name, score]) grades = sorted(set([score for name, score in lst])) second_lowest_grade = grades[1] second_lowest_students = [name for name, score in lst if score == second_lowest_grade] second_lowest_students.sort() for student in second_lowest_students: print(student)
n=[] s=[] l=[] a=int(input()) for i in range(a): name = input() score = float(input()) n.append([name,score]) s.append(score) o=min(s) while o in s: i=s.index(o) n.pop(i) s.remove(o) x=min(s) while x in s: i=s.index(x) l.append(n[i]) n.remove(n[i]) s.remove(s[i]) l.sort() for i in l: print(i[0])
if name == 'main': l = [] scores = [] for _ in range(int(input())): name = input() score = float(input()) l.append([name,score]) scores.append([score])
if name == 'main': students=[] for _ in range(int(input())): name = input() score = float(input()) students.append([name,score]) a=[] b=0.0 c=[]
for i in range (0,len(students)): a.append(students[i][1])
a.sort()
for i in range (0, len(a)-1):
for i in range(0,len(students)): if(students[i][1]==b): c.append(students[i][0])
c.sort()
for i in range(0,len(c)): print(c[i])