You are viewing a single comment's thread. Return to all comments →
n = int(input("Enter number of Students: ")) stu_list = []
# Collecting student names and scores for i in range(n): name = input("Student name: ") score = float(input("Score: ")) stu_list.append([name, score])
# Collecting student names and scores
([name, score])
# Extracting only the scores marks_list =[x[1] for x in stu_list]
# Extracting only the scores
[x[1] for x in stu_list]
# Finding the second lowest score m = sorted(set(marks_list)) # Sorting unique scores
# Finding the second lowest score
for name in names: print(name)
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Nested Lists
You are viewing a single comment's thread. Return to all comments →
n = int(input("Enter number of Students: ")) stu_list = []
# Collecting student names and scores
for i in range(n): name = input("Student name: ") score = float(input("Score: ")) stu_list.append([name, score])
# Extracting only the scores
marks_list =[x[1] for x in stu_list]
# Finding the second lowest score
m = sorted(set(marks_list)) # Sorting unique scoresPrinting names
for name in names: print(name)
Printing names
for name in names: print(name)