What is a Module in Python
A Module can be defined as a file containing some Python definitions and statements. The module name is the same as the file name (the file name is suffixed with .
py). Within a module, the module’s name (as a string) is available as the value of the global variable
You can create modules on your own. For example, let’s create a module which upon calling returns the factorial of a number. This file is named as test.py.
def fact(n): if n==1: return n else: return (n*fact(n-1))
Similarly, we can define as many modules as you need. There are a lot of built-in modules in Python.
Please login to comment
View all comments