python math problem

John Machin sjmachin at lexicon.net
Fri Feb 15 21:51:31 EST 2013


On Feb 16, 6:39 am, Kene Meniru <Kene.Men... at illom.org> wrote:

> x = (math.sin(math.radians(angle)) * length)
> y = (math.cos(math.radians(angle)) * length)

A suggestion about coding style:

from math import sin, cos, radians # etc etc
x = sin(radians(angle)) * length
y = cos(radians(angle)) * length

... easier to write, easier to read.



More information about the Python-list mailing list