Posts

Showing posts with the label Modules

Python3 Modules

Python  Modules Modules :              Modules refer to a file containing Python statements and definitions.    A file containing Python code, for eg: abc.py, is called a module and its module name would be "abc"   We use module to break down a large programs into simpler manageable and organized files. Furthermore, module provide reusability of code.   We can define our most used functions in a module  and import it, instead of copying their definitions into different programs. How to import a module?  We use the import keyword to do this.        import example      #imported example module   Using the module name we can access the function using dot( . ) operation.        example.add(10,10) output :  20 Python has a lot of standard modules available. Example:        import math        print(math.pi) output: 3.141592653589793        import datetime        datetime.datetime.now( ) output: datetime.datetime(2020,10,18,47,20,606228) import with renaming        import math as