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
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]
Comments
Leave a comment