Answer to Question #288910 in Python for sai krishna

Question #288910

a class of students p gave a science viva their final results are listed out in the order of their roll numbers in the list s the teacher asked the students to note the number of students who gave the viva after them and got less score than them write a program to get the final list from the students in the roll number order


1
Expert's answer
2022-01-20T01:46:38-0500
def dic(student_names, scores):
    list1 = []
    ran_stud = input('Enter student name here: ')
    ind1 = student_names.index(ran_stud)
    score1 = scores[ind1]
    return [x for x in scores if x < score1]

dic(['David', 'Samuedic(['David', 'Samuel', 'Stevo', 'Brainy', 'Frank', 'Daniel', 'Paul', 'Peter', 'Taiwo', 'Kenny'], [90, 98, 21, 87, 65, 90, 34, 76, 91, 46])l', 'Stevo', 'Brainy', 'Frank', 'Daniel', 'Paul', 'Peter', 'Taiwo', 'Kenny'], [90, 98, 21, 87, 65, 90, 34, 76, 91, 46])
Enter student name here: Samuel

Out[2]:
[90, 21, 87, 65, 90, 34, 76, 91, 46]

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