Ec210g - Lab Manual
Ec210g - Lab Manual
LAB MANUAL
NAME OF COURSE: PYTHON PROGRAMMING
COURSE CODE: EC210G
Govt. Polytechnic, Nagpur Python Programming
Update Dictionary
Delete Dictionary
Looping through Dictionary
10. Develop & Execute Python program to 4. Python
demonstrate math built-in functions. (Any functions, modules 02
two programs) and packages
11. Develop and execute user defined Python
function for given problem: -
Function with minimum two 02
arguments.
Function returning values.
12. Develop and execute Python program to
demonstrate use of: -
Built-in module (e.g. Keyword, math, 02
number, operator)
User defined module.
13. Develop and execute Python program to
demonstrate use of: -
Built-in packages (e.g. NumPy, 02
Panda)
User defined packages.
14. Develop and execute Python program to 5. Object oriented
demonstrate following operations: - programming in
Python 02
Method Overlapping
Method Overriding
15. Develop and execute Python program to
demonstrate following operations: -
02
Simple Inheritance
Multiple Inheritance
16. Develop and execute Python program to 6. File I/O
handle user defined exceptions for given handling and
Exception and
02
problems.
handling
Skill Assessment
Total Hrs. 32
Govt. Polytechnic, Nagpur Python Programming
COURSE OUTCOMES:
After completing this course student will be able to–
1. Display message on screen using Python script on IDE.
2. Develop Python program to demonstrate use of operators.
3. Perform operations on data structure in Python.
4. Develop Python functions for given problem.
5. Design Python classes for given problem.
6. Handle exceptions in Python file management.
Govt. Polytechnic, Nagpur Python Programming
INDEX
Delete Set
9 CO3 Develop and execute simple Python
program to perform following operations
on Dictionary: -
Create Dictionary
Access Dictionary
Update Dictionary
Delete Dictionary
Looping through Dictionary
10 CO4 Develop & Execute Python program to
demonstrate math built-in functions.
(Any two programs)
11 CO4 Develop and execute user defined
Python function for given problem: -
Function with minimum two
arguments.
Function returning values.
12 CO4 Develop and execute Python program to
demonstrate use of: -
Built-in module (e.g. Keyword,
math, number, operator)
User defined module.
13 CO4 Develop and execute Python program to
demonstrate use of: -
Built-in packages (e.g. NumPy,
Panda)
User defined packages.
14 CO5 Develop and execute Python program to
demonstrate following operations: -
Method Overlapping
Method Overriding
15 CO5 Develop and execute Python program to
demonstrate following operations: -
Simple Inheritance
Multiple Inheritance
16 CO6 Develop and execute Python program to
handle user defined exceptions for given
problems.
17 Python Mini Project
Govt. Polytechnic, Nagpur Python Programming
RUBRICS
Govt. Polytechnic, Nagpur Python Programming
Experiment No. 1
Apparatus:
Theory:
Installation of Python:
Search Python
Select the version of Python to install
Result:
REVIEW QUESTIONS:
1. How to install Python IDE?
2. For installation, which option is selected.
3. Why users click on customize option?
4. State the reason; Python called as interpreter and not compiler?
5. For what purpose Python is required.
Sr.
No CO Course Outcomes
.
1 CO1 Display message on screen using Python script on IDE.
Govt. Polytechnic, Nagpur Python Programming
Experiment No. 2
Apparatus:
Theory:
3. The message can be defined using variable and then variable can be
printed.
User defined number- The number is defined by the user by using int.
The int, used for integer value in the beginning of code.
5. For printing number, use int (integer value) in the beginning of code.
Govt. Polytechnic, Nagpur Python Programming
Result:
In this experiment, we have study how to print simple python program for
displaying message.
REVIEW QUESTIONS:
1. Which is the main element for printing a sentence?
2. In how many ways the sentence is printed.
3. What do you mean by Pre-defined and User- defined statement?
Sr.
No CO Course Outcomes
.
2 CO1 Display message on screen using Python script on IDE.
Govt. Polytechnic, Nagpur Python Programming
Experiment No. 3
Apparatus:
Theory:
number;
~ (-3) = 4
~ (-2) = 3
REVIEW QUESTIONS:
1. State different types of operators.
2. How Arithmetic operator operates.
3. How Logical operator operates.
4. How bitwise operator operates.
Sr.
No CO Course Outcomes
.
3 CO2 Develop Python program to demonstrate use of operators.
Govt. Polytechnic, Nagpur Python Programming
Experiment No. 4
Apparatus:
Theory:
Syntax- if:
Statement (s)
Syntax- if:
Statement (s)
else:
Statement (s)
Govt. Polytechnic, Nagpur Python Programming
Syntax- if:
Statement (s)
elif:
Statement (s)
else:
Statement (s)
Syntax: -if:
if:
Statement (s)
else:
Statement (s)
else:
Statement (s)
Program:
If statement: -
Code: -
Govt. Polytechnic, Nagpur Python Programming
Output: -
If-else statement: -
Code: -
Output: -
Govt. Polytechnic, Nagpur Python Programming
Nested If Statement: -
Code: -
Output: -
REVIEW QUESTIONS:
1. State different types of conditional statements.
2. How if condition works.
3. State the use of if condition.
4. State the use of if-else condition.
5. State the use of nested if condition.
6. How if-else condition works.
7. How nested if condition operates.
RELEVANT COURSE OUTCOMES:
Sr.
No CO Course Outcomes
.
4 CO2 Develop Python program to demonstrate use of operators.
Govt. Polytechnic, Nagpur Python Programming
Experiment No. 5
Apparatus:
Theory:
While Loop: - Is used for the situation where the user is not sure how
much data the application will have to process. This kind of loop is used
when user needs to perform task such as downloading files of unknown
size.
Syntax: - while expression:
Statement
For Loop: - This loop begins with for statement. For loop works through
a sequence of type. The sequence may be series of letters in a string or a
specific range of values.
Syntax: -for iterating _ var in sequence:
Statement
Nested Loop Statement: - Either for loop or while loop is used. Nesting
the while loop in for loop.
Syntax: - for iterating _ var in sequence:
Statement
while expression:
Statement
Govt. Polytechnic, Nagpur Python Programming
Program:
While Loop:
Code: -
Output: -
For Loop:
Code: -
Output: -
Govt. Polytechnic, Nagpur Python Programming
Nested Loop:
For loop: -
Code: -
Output: -
While Loop:
Code: -
Govt. Polytechnic, Nagpur Python Programming
Output: -
REVIEW QUESTIONS:
1. State different types of looping statements.
2. How while loop works.
3. State the use of while loop.
4. State the use of for loop.
5. State the use of nested loops.
6. How for loop works.
7. How nested loop operates.
Sr.
No CO Course Outcomes
.
5 CO2 Develop Python program to demonstrate use of operators.
Govt. Polytechnic, Nagpur Python Programming
Experiment No.6
Accessing List: -after creating list user can, access the information i.e.
stored in list. For accessing the list, we can write print() statement or
single elements in list can also be printed by defining specific location of
that element. The user can also access range of elements in defined list
using a[first location: last location]
Govt. Polytechnic, Nagpur Python Programming
Delete List: -The delete list consists of different functions such as pop(),
remove() and clear(), with the help of these functions user can delete the
list.
Result: -In this experiment, we have studied the different functions that can be
performed by list.
REVIEW QUESTIONS:
1. State different functions of executing Python code by list.
2. How append() function works.
3. State the advantages of using list.
4. State different operations used for adding an element to the list.
5. State different operations used for removing element from the list.
6. How extend() function operates in the list.
7. State different methods for accessing a list.
8. To access a particular number, the user enters a number or a specific
location, state true or false.
9. Compare the list functions pop() and remove().
Sr.
No CO Course Outcomes
.
6 CO3 Perform operations on data structure in Python.
Govt. Polytechnic, Nagpur Python Programming
Experiment No.7
Theory:
Accessing Tuple: -After creating tuple user can, access the information
i.e. stored in tuple. For accessing the tuple, we can write print() statement
or single elements in tuple can be printed by defining specific location of
that element. The user can also access range of elements in defined list
using a[first location: last location]
Govt. Polytechnic, Nagpur Python Programming
Delete Tuple: - The delete tuple consists of del() function, with the help
of this function user can delete the tuple.
Govt. Polytechnic, Nagpur Python Programming
Result: -In this experiment, we have studied the different functions that can be
performed by tuples.
REVIEW QUESTIONS:
1. State different functions of executing Python code by tuple.
2. State, how tuple() function works.
3. State the advantages of using tuple.
4. State different operations used for adding an element to the tuple.
5. State, how del() function works.
6. State different methods for accessing a tuple.
7. To access a particular number, the user enters a number or a specific
location, state true or false.
Sr.
No CO Course Outcomes
.
7 CO3 Perform operations on data structure in Python.
Govt. Polytechnic, Nagpur Python Programming
Experiment No.8
Create Set: - The set is a built–in function, for creating set integer values
are used. The sets are created by using set([]) or by using {} brackets.
Deleting Set: - The delete set consists of del() and .clear() functions,
with the help of this function user can delete the set.
Result: -In this experiment, we have studied the different functions that can be
performed by set.
Govt. Polytechnic, Nagpur Python Programming
REVIEW QUESTIONS:
1. State different functions of executing Python code by using set.
2. State, how set() function works.
3. State the advantages of using set.
4. State different operations used for adding an element to the set.
5. State, how del() function works.
6. State different methods for accessing a set.
7. State, how the numbers get added and removed in the set.
8. State the use of .union() and .intersection() in the set.
Sr.
No CO Course Outcomes
.
8 CO3 Perform operations on data structure in Python.
Govt. Polytechnic, Nagpur Python Programming
Experiment No.9
Apparatus:
Theory:
Result: -In this experiment, we have studied the different functions that can be
performed by dictionary.
REVIEW QUESTIONS:
1. State different functions of executing Python code by using dictionary.
2. State, how dictionary {} bracket works.
3. State the advantages of using dictionary.
4. State different operations used for adding an element to the dictionary.
5. State, how del() function works.
6. State different methods for accessing a dictionary.
7. State, how the numbers get updated in the dictionary.
8. State the use of .keys() in dictionary.
Sr.
No CO Course Outcomes
.
9 CO3 Perform operations on data structure in Python.
Govt. Polytechnic, Nagpur Python Programming
Experiment No.10
Apparatus:
Theory:
element.
4 .degrees() Used for printing degrees value of a particular
element.
5 .exp() Used to provide exponential value of a
particular element.
6 .sin(),.cos(),.tan() Trigonometry functions can be performed by
math in built function.
7 .log() Performs logarithmic functions.
8 .floor(), .ceil() Used for providing round off value i.e.
incremented value or decremented value.
Result: -In this experiment, we have studied the different functions that can be
performed by using math function.
REVIEW QUESTIONS:
1. State different functions for executing Python code by using math built-in
function.
2. State how does math function operates.
3. State the advantages of using math function.
Govt. Polytechnic, Nagpur Python Programming
Sr.
No CO Course Outcomes
.
10 CO4 Develop Python functions for given problem.
Experiment No.11
Develop and execute user defined Python function for given problem: -
Function with minimum two arguments.
Function returning values.
Apparatus:
Theory:
Result: -In this experiment, we have studied the use of user defined python
function.
REVIEW QUESTIONS:
1. State the use of user defined python function.
2. State how python functions defined.
3. State the advantages of using python function.
4. State different operations performed by python function.
5. State meaning of return function.
6. State how arguments are defined and also functions are called.
7. State the comparison between Global variables and Local variables.
Govt. Polytechnic, Nagpur Python Programming
Sr.
No CO Course Outcomes
.
11 CO4 Develop Python functions for given problem.
Experiment No.12
User defined Module: The user-defined modules are not only but
defined functions.
REVIEW QUESTIONS:
1. State the use of Built-in module.
2. State the uses of different in-built keywords.
3. State the advantages of using built-in module and user-defined modules.
4. State different operations performed by built-in module.
5. User defined modules are called as user defined functions, state true or false.
6. State how arguments defined in user defined modules.
RELEVANT COURSE OUTCOMES:
Sr.
No CO Course Outcomes
.
12 CO4 Develop Python functions for given problem.
Experiment No.13
Apparatus:
Theory:
Experiment No.14
Apparatus:
Theory:
REVIEW QUESTIONS:
1. State the use of classes.
2. State the uses of method overloading and method overriding in python.
3. State the use of function overloading.
4. State the use of operator overloading.
5. Comparison between function and operator overloading.
6. Do operation and functions are same, state true or false.
RELEVANT COURSE OUTCOMES:
Sr.
No CO Course Outcomes
.
1 CO5 Design Python Classes for given problem..
Experiment No.15
Apparatus:
Theory:
Simple Inheritance: