On Sun, Feb 7, 2010 at 3:17 PM, davedo2 <dave...@gmail.com> wrote:
> I want to run a range of numbers through the factor() function and if
> I run a loop through a list as in:
> for i in [25,37,205]:
>    print i.factor()
> it works fine, but if I try
> for i in range(1,5):
>    print i.factor()
> I get the error message 'int' object has no attribute 'factor' - how
> do I get
> factor() to work with a range? Thanks...Dave

for i in [1..4]:
    print i.factor()

 -- or  --

for i in range(1,5):
    print Integer(i).factor()


-- or --


for i in range(1,5):
    print factor(i)


William



>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to