Answer to Question #210063 in Python for Dhana

Question #210063
  1. The placement session has begun in a college. There is N number of students standing outside an interview room in a line. It is given that the person who goes first has higher chances of selection.
  2. Each student has a number associated with them representing their problem-solving capability. The higher the capability the higher the chances of selection. Now every student wants to know the number of students ahead of him with higher problem-solving capability.
Input: 6(number of students) {4 , 9 , 5 , 3 , 2 , 10}
Output:  {0 , 0 , 1 , 3 , 4 , 0}




1
Expert's answer
2021-06-23T17:06:13-0400
n       = int(input('number of student: '))
student = list(map(int, input().split()))

if __name__ == '__main__':
    print(0, end=' ')
    for i in range(1, n):
        t = 0
        for j in range(1, i):
            if student[j] >= student[i]:
                t += 1
        print(t, end=' ')

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