the program needs to return true if the factors of n other than n sum up to n. i need to use the function name during runtime. when i input
factors(45)
it shows that there is an unexpexted token error. please check what is wrong with the program.
def factors(n):#unexpected token error
factorlist = []
for i in range(1,n):
if n%i == 0:
factorlist = factorlist + [i]
return(factorlist)
def perfect(n):
if sum(factorlist) == n:
return(True)
else :
return(False)