Course Content
Python Indentation, Comments and Variables
0/2
Object Oriented Programming in Python
0/1
Exception Handling in Python
0/1
Sending emails with Python
0/1
Unit test in python programming
0/1
Python programming (zero to advance!!!)
About Lesson

MODULES VS FUNCTIONS IN PYTHON PROGRAMMING

In Python, both inbuilt functions and modules serve different purposes.

1. Inbuilt Functions:
– Inbuilt functions are predefined functions that come with the Python interpreter.
– They are ready-to-use and do not require importing any module explicitly.
– Examples of inbuilt functions include `len()`, `print()`, `type()`, `sum()`, etc.
– These functions are part of the core Python language and can be used directly without additional imports.

2. Modules:
– Modules are files containing Python code that define functions, variables, and classes that can be used in other Python scripts.
– Modules provide a way to organize and structure code, making it more modular and reusable.
– To use the functions or variables defined in a module, you need to import that module into your script using the `import` keyword.
– Examples of modules include `math`, `datetime`, `random`, etc. Each of these modules contains functions and classes related to specific functionalities.

In summary, inbuilt functions are functions that are available without the need for explicit imports, while modules are collections of code, including functions and classes, that need to be imported to be used in a script. Modules are a way to organize and distribute reusable code in Python.

Join the conversation