Answer to Question #302870 in Python for soumya

Question #302870

arun is in a class with N students he knows the height of each student in the class. he then tries to answer Q queries. in each query, he is given an integer X and he has to find the number of students in the class who have a height of at least X

I/p: the 1st line of input two space separated integers N & Q. The second line of input contains N space separated integers, the height of the N students in the class. each of the next Q lines contain one single integer X.

output: the output consists of Q lines where each line contains the answer of J th query (1<=j<=0)

I/p: 3 1

100 160 130

120

O/p: 2

input: 5 5

1 2 3 4 5

6

5

4

3

2

output:


1

2

3

4


1
Expert's answer
2022-02-26T11:31:58-0500
n, m = map(int, input().split())
h = map(int, input().split())
for i in range(m):
  x = int(input())
  r = 0
  for y in h:
    if x <= h:
      r = r + 1
  print(r)

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