What are modules and packages in Python?

Question

Explain its advantages

in progress 0
Pragya Rani 55 years 1 Answer 828 views Contributor 0

Answer ( 1 )

  1. A module is a Python file containing Python statements and definitions. For example, a file evenodd.py is a module, and we call it ‘even-odd’. We put similar code together in one module. This helps us modularize our code, and make it much easier to deal with. And not only that, a module grants us reusability.
    A package, in essence, is like a directory holding sub-packages and modules. While we can create our own packages, we can also use one from the Python Package Index (PyPI) to use for our projects.

Leave an answer

Browse
Browse