Answer to Question #302861 in Python for soumya

Question #302861

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

I/p: the 1st line contains a single integer N that represent the no.of students in class. the 2nd line contains N space separated integers representing the scores of the students in the order of their roll no.s

O/p: the output should contain N space separated integers representing the count of students as mentioned above

Input : 3

13 12 11

output: 2 1 0

input: 4

4 3 5 2

output:

2 1 1 0


1
Expert's answer
2022-02-26T11:32:04-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])

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