Find perfect number smaller than n
Hi everyone, I tried to write a program, that returns the perfect numbers smaller than n. For example, if n is 10, the program should return "6". This is my code: https://code.sololearn.com/ca2A1A0A21a1 My problem with my code is that it returns only 1 number lower than n e.g. 9 if n=10 and so on. If I "return sum" - I get 240 if n = 10. I don't get it... Apprreciate any help!