MAXVAC - Editorial

What’s wrong in my answer

from audioop import reverse

b = 0
index = 0
t = int(input())
for i in range(1,t+1):
n,w = input().split()
n = int(n)
w = int(w)
a = list(map(int, input().split()))
a.sort(reverse=True)
print(a)
for indexs in a:
index += 1
b += indexs
if b > w:
print(n-index)
break
if indexs == a[-1] and b <= w :
print(‘0’)
break
b = 0
indexs = 0
index = 0

Hey can you please provide your code along with proper indentation, as it is pretty confusing what a python code is exactly intended to do without indentation

You’re in the wrong topic @nishu_real ; here is the HOLIDAYS editorial

As a general hint though, you can preserve formatting by adding a line that starts with three back ticks ``` before and after your code.

As a specific observation, you don’t need the audioop library for any problem on this site that I know of. The sort/sorted built-ins take reverse as a parameter anyway.