Module are very helpful when a file containing number of functions and you can use them in other file.
Creating a module
area.py
def square(side): return side*side def rectangle(length, width): return 0.5*length*width
Importing module
import area
using function of a module
area_of_square = area.square(10) print(area_of_square)
importing module and rename
import area as a area_of_rectangle = a.rectangle(2, 5) print( area_of_rectangle )
import specific function from a module
from area import square area_of_square = square(4) print( area_of_square )