Python has many modules already defined.

The one I use the most is the module of math, because I can find  values like “pi”, functions as “sin”, etc.

How to import to your code? As simple as this:

from #(name of module) import #(the function)

For example, I want to import pi value:

from math import pi

And here’s the code running with Cygwin!

 

mod

CC BY 4.0 Masteries: 13.Importing and using Python modules by Lourdes García is licensed under a Creative Commons Attribution 4.0 International License.