# [Tutor] Question on lists

**Tom Jenkins
**
TomJenkins@zentuit.com

*Thu, 18 Mar 1999 17:04:04 -0500*

>* # Factor by trial division:
*>* def factor(n):
*>* a = [] # Is there a better way to define a?
*>* k = floor(sqrt(n))
*>* for i in range(2, k+1):
*>* if n%i == 0:
*>* a.append(i) ### (append rather than insert)
*>* a.extend(factor(n/i)) ### add the factors of the quotient
*>* return a ### don't break; just return
*>* # if not divisible by any of the above, then it must be prime
*>* return [n]
*>*
*Hi Joe,
I get an AttributeError on extend. Is this a 1.5.2 enhancement? Or is
there a compile time option (I grabbed the binaries for both Win & Linux).
Thanks,
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Tom Jenkins DevIS (http://www.devis.com)
Y2K problem? The Mayans didn't have a millennium-2K problem!
Eric S. Raymond at IPC7, on learning that the Mayan calendar
takes 28 octillion years to wrap around