Standard Library Module in Python – CBSE Class 12
Standard Library Module in Python
In this tutorial, we shall be learning about some standard library modules in python. Before beginning the main topic, first of all we need to know.
What is a module in python?
A module in something (a, file) that contains some variable and constants some functions (predefined), objects etc.
Standard library module in python :- A (python file) can be used in your program to get predefined functionality in your python program. Here, you need not to write any extra python code to use it in a python program.
In order to use a module, you just need to first import that module in your program and then you can use all the functions defined in that module in your program.
Definition: –
Technically we can say “a python module is a file (.py) which contains some enables and consonant functions and objects in it which can be used in other python programs by importing it”
A module is always having some predefined python functions for use only by calling in your program after importing the module
Example
in order to use functions of math module, you need to writing the import statement at the top of your python program of as follows
import math
New, you can use any math library’s function as by writing.
math < function-name >
<function-name> can use any function that is already defined in math module
Program >>> import math
>>> math. Sort (25)
Output >>> 5
2. Advantages of using module in python
A module is a separate unit (.py file) in itself. It Facilitates the following benefits to a python program
- It reduces the complexity of a python program.
- It creates a number of well-defined documented boundaries within the program.
- It also can be reused in other programs without having to rewrite the same code again & again.
For example, if someone has created a module say ‘play Audio’ to play different audio formats, coming from different sources, e.g., mp3player, FM-radio player, DVD player etc. now, while writing a different program, if someone wants to incorporate FM-radio into it, he needs not re-write the code for it. rather, he can use the FM-radio functionality from play audio module. Is not that amazing? re- usage without any re-work – well, that’s the beauty of modules.
Why Standard Library Module in Python
In this tutorial, we have learnt about Standard Library Module in python for cbse class 11 & 12 and it’s related concepts according to cbse syllabus. This tutorial is useful for Central Board of secondary education (CBSE) student of class 11th and 12th , who opted computer science (Code 083) as an optional subject. This topici is also important to start learning python programing language for beginners of class 11th and 12th.
You can check the latest cbse syllabus for computer science Click here for syllabus OR Click here
UNIT NO. | UNIT NAME | MARKS |
1 | Computational thinking and programming | 40 |
2 | Computer network | 10 |
3 | Database management | 20 |
4 | Practical | 30 |
5 | Total | 100 |
Unit II: Computational Thinking and Programming – 1
According to the syllabus , Unit II Computational Thinking and Programming – 1 has the above concepts for learning related to python Standard Library Module in Python.
Exam Time
Chapter : Using Python Modules
IMPORTANT QUESTIONS : Asked in examinations of Class 12th Computer Science
Coming Soon
Read more
-
structure of module in python
-
arithmetic operators
-
operators in python
-
types of operators
-
logical operators
-
membership operators
-
standard library module
- Identifiers in python