5.
Dictionaries the set
Topic :Python package
Introduction:
●Definition
●Used
●Example
●Key features
●Advantage
■Definition:
A python package is a way of organizing related modules (python files) into a single directory
(foldes) that makes code modular, reusable, and manageable.
A package must contain a special file called _init_.py to be recognized as a package.
■Uses:
•Data science (eg:numpy)
•Web development(eg:flask)
•Machine learning (eg:scikit-learn)
•Game development (eg:pygame)
•Utility function (eg:math,string)
■Syntax:
Package-name/
_init_.py
■Example:
def add(a,b)
Return a+b
Print(math_utils.add(10,5))
def shout(text):
return [Link]()
Output:
15
HELLO
■Key features:
[Link] – code is split into organized modules.
[Link] – Function can be reused across multiple projects.
[Link] management - Prevents naming confilicts.
[Link] hierarchy – Packages can have sub-packages.
[Link] – Useful for small scripts to large applications.
■Advantage:
▪︎Keeps code organized & clean.
▪︎Makes large projects easier to manage.
▪︎Encourages code reuse.
▪︎Prevents naming collisions between modules.
▪︎Supports hierarchical structuring of code.