0% found this document useful (0 votes)
11 views

Experiment No 8 Module

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Experiment No 8 Module

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING

ENGINEERING LAB

Expt. No. 8
Date : Program Based on Concept of Module.

Purpose:
Students must Learn Python Module because
 Access to Libraries: Learning how to use modules enables us to leverage their built-
in functionality for complex tasks (like data analysis, machine learning, web
development) without needing to build everything from scratch.
 Faster Learning and Application: We can quickly start building real-world
applications by using existing Python modules. Modules like math, random provide
built-in functions that you can use right away, allowing you to focus on
understanding Python basics instead of writing everything manually.
 Learning How to Import and Use Libraries: Learning about Python modules
teaches us how to import and use these libraries, opening the door to more advanced
projects.
 Learning Problem-Solving Skills: When we learn how to use different modules,
you also improve your problem-solving skills. we begin to think of problems in
terms of what modules or pre-built tools can help you solve them, rather than
starting from zero each time.

Objectives:
 Understand the Concept of Modules: Learn what Python modules are and how
they help break down complex programs into smaller, manageable units
 Learn to Import and Use Built-in Modules: Master how to import and use built-in
Python modules
 Enhance Problem-Solving Skills Using Modules: Use Python modules to solve
real-world problems effectively

PYTHON LAB MANUAL MVS ADCET 1


DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING
ENGINEERING LAB

Theory:
Module is a file containing python definitions, functions, variables, classes and statements.
The extension of this file is .py.
1) Importing Python Modules:
a) Using Import statement:
 import < module_name
 import < module1>, <module2>………. <module>
 To access a particular method from any module: ModuleName.functionName()

b) Using from statement:


 Used to access specific or all attributes from a module
 from < module>import<function name>
 from < module>import<function name1>, <function name2>..<funN>
 OR from < module>import*

PYTHON LAB MANUAL MVS ADCET 2


DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING
ENGINEERING LAB

2. Module Aliasing:
 Aliasing means to give an alternating name. We can rename the module at the time
of import, using as keyword.
 import<Module Name> as <alias name>

PYTHON LAB MANUAL MVS ADCET 3


DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING
ENGINEERING LAB

3.Math module in Python:


It contains different types of mathematical function. Most of the functions in this module
returns a float value. Ceil function returns the smallest integer not less than x. Floor returns
the largest integer not greater than x. POW returns the value of x raised to power y. Fabs
returns the absolute value of float x. Degree converts x from radians to degrees. Radians

functions converts x from degrees to radians.

PYTHON LAB MANUAL MVS ADCET 4


DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING
ENGINEERING LAB

4. Statistics Module in Python:


This Module provides functions for calculating statistics for numeric data. Mean
function returns the arithmetic mean (average) of data. Median function returns the middle
value of data. The Mode function returns the most repeated value.

Problem Solving Skills:

Q.No Problem Statement CO BL


1. Write a Program based on the Math module in python 2EEVS207_5 K3
Write a Program based on the concept of Module
2. 2EEVS207_5 K3
aliasing.
Write a Program based on the concept of Statistics 2EEVS207_5 K3
3.
Module
4. Write a Program based on the concept of Import and 2EEVS207_5 K3
From statement

Critical Thinking Skills and Collaboration

PYTHON LAB MANUAL MVS ADCET 5


DEPARTMENT OF ELECTRICAL 2EEVS207, PYTHON PROGRAMMING
ENGINEERING LAB

Q. No Question CO BL
1. What is the difference between Import and From statement? 2EEVS207_5 K1
2. What are the Functions in Math Module? 2EEVS207_5 K1
3. What are the Functions in Statistics Module? 2EEVS207_5 K1
4. What is the difference between Ceil and Floor in Math module? 2EEVS207_5 K1
5. What is the meaning of Mean, Mode and Median ? 2EEVS207_5 K1

Conclusion:

PYTHON LAB MANUAL MVS ADCET 6

You might also like