Skip to content

Modules in Python

wilsonshamim edited this page Jun 12, 2018 · 3 revisions

modules are like other python files with functions, variables. A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use. A module is a Python object with arbitrarily named attributes that you can bind and reference.

Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.

Steps:

  1. create a python files named FunctionDemo.py.
  2. create a function sum. now you can access the function using below

from FunctionDemo import sum,lambdafun print("---",sum(1,3)) print(lambdafun(1,3,4))

Clone this wiki locally