PYTHON LIBRARY

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Module:

A module is a file that contain set of code or functions with the.py extension. A module
may contain variables, functions, classes etc. It is not executable.

As our program grows bigger, it may contain many lines of code. Instead of putting
everything in a single file, we can use modules to separate codes in separate files as per
their functionality. By grouping related code into modules, the code becomes easier to
understand and implement.

Ex. def add(x,y):

return x + y

Script:

A Script is a file that contain set of code with the .py extension and it is executable.

Ex. def add(x,y):

return x + y

result=add(5,6)

print(result)

Package :

It is a collection of related modules that work together to provide certain functionality. It is


just like a folder which contain lots of .py files of related modules and one init.py file which
show package.

 Packages in Python are installed using a package manager like pip (a tool for installing
and managing python packages).
 Ex. pip install pandas, pip install matplotlib, pip install NumPy

Library:

 A library is a collection of related modules or packages that allows to perform wide


range of functionality without writing your code.
 These are also called built-in modules. Python caters to a large collection of built-in
modules. Programmers can use these modules in Python programs by directly
importing them by invoking their name along with the keyword 'import'. There
are over 137,000 python libraries present today.
 In course – There are 3 libraries:
 1. Pandas 2. Matplotlib 3. NumPy

You might also like