The math moduleΒΆ
The math
module contains the kinds of mathematical functions you would typically find on your calculator and some mathematical constants like pi and e.
Here are some items from the math module in action.
If you want more information, you can check out the Math Module Python Documentation.
Like almost all other programming languages, angles are expressed in radians rather than degrees.
There are two functions radians
and degrees
to convert between the two popular ways of measuring angles.
- Notice another difference between this module and our use of
turtle
. - In
turtle
we create objects (eitherTurtle
orScreen
) and call methods on those objects (recallalex
andtess
). - Mathematical functions do not need to be constructed.
- They simply perform a task.