python math problem

John Machin sjmachin at lexicon.net
Sat Feb 16 03:51:31 CET 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