Modules in Python


A module is simply a python file where statements, classes, Objects, functions, constants and variables are defined. The file name is the module name with .py extension. Definitions from a module can be imported into other modules. It is a kind of code.

We can use the module we created, by using the import statement.

Functions of math module

To work with the functions of the math module, we must import the math module in the program.

import math



Functions of random module

To work with the functions of a random module, we must import a random module in the program.

import random


Functions of statistics module

To work with the functions of the statistics module, we must import the statistics module in the program.

import statistics




learn | code |crack

Learn With Me

Terms | Privacy | Security | Do not share your personal information