Answer to Question #247858 in Python for Raju

Question #247858

Student ID Map


you are given a sequence of student names Ni and their ids Di(corresponding to the student at the same index in Ni).


Write a program to print the student name and his ID from Ni and Di in alphabetical order of the name.


Explanation


For Example, if the given student names sequence and IDs sequenceare the following.


Anand,Ramesh,Kiran

ID102, ID101, ID100


1
Expert's answer
2021-10-07T14:02:19-0400
n=int(input())
arr=[[input(),float(input())] for _ in range(0,n)]
arr.sort(key=lambda x: (x[1],x[0]))
names = [i[0] for i in arr]
marks = [i[1] for i in arr]
min_val=min(marks)
while marks[0]==min_val:
    marks.remove(marks[0])
    names.remove(names[0])    
for x in range(0,len(marks)):
    if marks[x]==min(marks):
        print(names[x])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS