Can anyone tell me what I am doing wrong here. When trying to call the factors
function from main with x = factors(Tn), getting the error message: “TypeError:
'int' object is not callable”? Any help would be appreciated. Thanks.
def factors(n):
L = []
for i in range(1, int(n ** 0.5) + 1):
if (n % i == 0):
L.append(i)
return L
def main():
factors = 0
counter = 0
L = []
while len(L) < 50:
counter += 1
L.append(counter)
Tn = sum(L)
x = factors(Tn)
#print x
print(sum(L))
if __name__ == '__main__':
main()
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor