Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
Defination of Module in Python?
A Python module is a file containing Python definitions and statements. A module can define functions, classes, and variables. A module can also include runnable code. Grouping related code into a module makes the code easier to understand and use. It also makes the code logically organized.
Why are modules used in Python?
Modules to break down large programs into small manageable and organized files.
We can define our most used functions in a module and import it, instead of copying their definitions into different programs.
User-defined Functions
These function are created by user as per their own requirement.
Built-in functions
These functions are not created by user as their own.
To create a module just save the code you want in a file with the file extension .py :
Save this code in a file named mymodule.py. ...
Import the module named mymodule, and call the greeting function: ...
Save this code in the file mymodule.py. ...
Import the module named mymodule, and access the person1 dictionary: