i need help optimizing this code
t=int(input())
while(t>0):
t=t-1
Number = int(input())
Sum = 0
for i in range(1, Number):
if(Number % i == 0):
Sum = Sum + i
if (Sum == Number):
print("YES" )
else:
print("NO" )
i need help optimizing this code
t=int(input())
while(t>0):
t=t-1
Number = int(input())
Sum = 0
for i in range(1, Number):
if(Number % i == 0):
Sum = Sum + i
if (Sum == Number):
print("YES" )
else:
print("NO" )
Do you need to run the loop till Number?
Disclaimer: If you leave your code out like this you run the risk of others copying your work.