[Tutor] i have a question???
Jacob S.
keridee at jayco.net
Thu Feb 3 22:04:25 CET 2005
>From what I understand, range() no longer allows you to use floats as
arguments. (Or it gives you a deprication warning)
This tutorial must be old.
Not the only way, but.
import math
num = 0
while num <= 2*math.pi:
## Do stuff to figure pi/6 things
num = num + math.pi/6.0 ## Don't forget .0 or you'll get an integer
result.
print ## Result thingy
Another way is to use Numarry (Numeric) arange() but that takes extra work.
;-)
Jacob
> This is from a tutorial
>
> "EXERCISE 3.9
> Use the math library to write a program to print out
> the sin and cos of numbers from 0 to 2pi in intervals
> of pi/6. You will need to use the range() function."
>
> Range won't let me use pi/6 as an incremator
> is there some other way i can accomplish this task
> im new to programming so all the help i can get is
> greatly appreciated.
> NI!
> alex
>
>
>
>
> __________________________________
> Do you Yahoo!?
> The all-new My Yahoo! - What will yours do?
> http://my.yahoo.com
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list