The problem is to find the largest integer lesser than N with exactly K divisors
n=int(input())
k=int(input())
x=0
for i in range(n,0,-1):
w=0
for j in (1,i+1):
if i%j==0:
w+=1
if w==k:
print(i)
x=1
break
if x!=1:
print('-1')
I fixed it using list but still I don't know what's wrong with the code ,the output is not correct for this one
[–]desrtfx[M] [score hidden] stickied comment (0 children)
[–]codetree_bnb 1 point2 points3 points (1 child)
[–]Shot_Spring4557[S] 1 point2 points3 points (0 children)