Master AI & Build your First Coding Portfolio with SkillReactor | Sign Up Now

Lesson 7 - Modules And Packages

7.2 Importing Modules

Python's import statement enables you to import necessary modules into your code.

import math

You can provide a custom name to the module during import. For example,

import math as mt

Don't need the entire module? Just import the specified function or variables as follows:

from math import pi

Here, we import only the value of π from the module math.