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

Advanced Python Programming Lab Manual 2025

The document is a laboratory manual for an Advanced Python Programming course aimed at diploma engineering students in Information Technology. It outlines the vision and mission of the educational institution, details the practical outcomes and skills to be developed through various experiments, and provides guidelines for both faculty and students. The manual emphasizes competency-based learning and the importance of hands-on experience in mastering Python programming for real-world applications.

Uploaded by

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

Advanced Python Programming Lab Manual 2025

The document is a laboratory manual for an Advanced Python Programming course aimed at diploma engineering students in Information Technology. It outlines the vision and mission of the educational institution, details the practical outcomes and skills to be developed through various experiments, and provides guidelines for both faculty and students. The manual emphasizes competency-based learning and the importance of hands-on experience in mastering Python programming for real-world applications.

Uploaded by

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

Diploma Engineering

Laboratory Manual

Advanced Python Programming


Course Code: DI02016011
Information Technology
2nd Semester
Enrolment No
Name
Branch
Academic Term
Institute

Information Technology Department


Advanced Python Programming (DI02016011)

DTE’s Vision:
To facilitate quality technical and professional education having relevance for both
industry and society, with moral and ethical values, giving equal opportunity and access,
aiming to prepare globally competent technocrats.

DTE’s Mission:
• Quality technical and professional education with continuous improvement of all the
resources and personnel
• To promote conducive ecosystem for Academic, Industry, Research, Innovations
and Startups
• To provide affordable quality professional education with moral values, equal
opportunities, accessibility and accountability
• To allocate competent and dedicated human resources and infrastructure to the
institutions for providing world-class professional education to become a Global
Leader (“Vishwa Guru”)

Institute’s Vision:
To develop technically proficient and ethically sound diploma engineers contributing
to industry and society needs.

Institute’s Mission:
• To impart quality technical education.
• To shape students towards sensitizing in ethical values and contributing to nature.
• To familiarize students with the world of work.

Department’s Vision:
To develop technically proficient and ethically sound diploma IT engineers to serve the
industry and society.

Department’s Mission:
• To impart IT engineering education through an effective teaching-learning process.
• Making our students contributory and believing in ethical values.
• Making students aware and practice current technology in industry.

Page 2 of 62
Advanced Python Programming (DI02016011)

Information Technology Department

Certificate

This is to certify that Mr./Ms ……………………………………………………………………


Enrolment No. ………….……………. of 2nd Semester of Diploma in Information
Technology department of Government Polytechnic Gandhinagar has satisfactorily completed
the term work in course Advanced Python Programming (DI02016011) for the academic year:
…………………… Term: Even( ).

Place:…………………..

Date: …………………..

Signature of Course Faculty Head of the Department

Page 3 of 62
Advanced Python Programming (DI02016011)

Preface
The primary aim of any laboratory/Practical/field work is enhancement of required skills as well as
creative ability amongst students to solve real time problems by developing relevant competencies in
psychomotor domain. Keeping in view, GTU has designed competency focused outcome-based
curriculum NEP (2020) for Diploma engineering programmes. In this more time is allotted to practical
work than theory. It shows importance of enhancement of skills amongst students and it pays attention
to utilize every second of time allotted for practical amongst Students, Instructors and Lecturers to
achieve relevant outcomes by performing rather than writing practice in study type. It is essential for
effective implementation of NEP curriculum. Every practical has been keenly designed to serve as a tool
to develop & enhance relevant industry needed competency in each and every student. These
psychomotor skills are very difficult to develop through traditional chalk and board content delivery
method in the classroom. Accordingly, this lab manual has been designed to focus on the industry
defined relevant outcomes, rather than old practice of conducting practical to prove concept and theory.

By using this lab manual, students can read procedure one day in advance to actual performance day of
practical experiment which generates interest and also, they can have idea of judgement of magnitude
prior to performance. This in turn enhances predetermined outcomes amongst students. Each and every
Experiment /Practical in this manual begins by competency, industry relevant skills, course outcomes
as well as practical outcomes which serve as a key role for doing the practical. The students will also
have a clear idea of safety and necessary precautions to be taken while performing experiment.

This manual also provides guidelines to lecturers to facilitate student-centred lab activities for each
practical/experiment by arranging and managing necessary resources in order that the students follow
the procedures with required safety and necessary precautions to achieve outcomes. It also gives an idea
that how students will be assessed by providing Rubrics.

Python is a modern language useful for writing compact codes specifically for programming in
the area of Server-side Web development, Data Analytics, AI, and scientific computing as well as
production tools and game programming. This course deals with some advanced features of the ‘Python’
language. The programming skills thus acquired can be used for developing programs with advanced
level programming features which in turn will be helping in developing practical applications for the
scientific, research and business purposes. At the end of the course, the student will be able to develop
programs with adequate advanced concepts using python language.

Although we try our level best to design this lab manual, but always there are chances of improvement

Page 4 of 62
Advanced Python Programming (DI02016011)

Programme Outcomes (POs):

1. Basic and Discipline specific knowledge: Apply knowledge of basic


mathematics, science and engineering fundamentals and engineering
specialization to solve the engineering problems.
2. Problem analysis: Identify and analyse well-defined engineering problems
using codified standard methods.
3. Design/ development of solutions: Design solutions for engineering well-
defined technical problems and assist with the design of systems components or
processes to meet specified needs.
4. Engineering Tools, Experimentation and Testing: Apply modern engineering
tools and appropriate technique to conduct standard tests and measurements.
5. Engineering practices for society, sustainability and environment: Apply
appropriate technology in context of society, sustainability, environment and
ethical practices.
6. Project Management: Use engineering management principles individually, as
a team member or a leader to manage projects and effectively communicate
about well-defined engineering activities.
7. Life-long learning: Ability to analyze individual needs and engage in updating
in the context of technological changes in field of engineering.

Page 5 of 62
Advanced Python Programming (DI02016011)

Practical Outcome - Course Outcome matrix


Course Outcomes (COs):
CO1: Develop python programs by applying data structures - dictionary, tuple, and set concepts.
CO2: Develop modules and packages in python programs for modular programming approach.
CO3: Implement error handling techniques using exception handling.
CO4: Develop python programs using file input/output operations.
CO5: Draw graphics using the turtle module.

Sr Practical Outcome/Title of experiment CO-1 CO-2 CO-3 CO-4 CO-5


No.
1 Write a program to demonstrate the set functions and
operations. √

2 i) Write a program to input n numbers from the user


and store these numbers in a tuple. Print the maximum
and minimum number from this tuple.
ii) Create a user-defined function that prints a tuple √
whose values are the cube of a number between 1 and
n (both included), Where n is an integer number and
passed as an argument

3 i) Write a program to count the number of times a


character appears in a given string using a dictionary
ii) Write a user-defined function to convert a number
entered by the user into its corresponding number in √
words. For example, if the input is 789 then the output
should be ' Seven Eight Nine ‘.

4 Write a program to define a module to find the area


and circumference of a circle.
i) import the module to another program. √
ii) import a specific function from a module to another
program

5 Create a package named DemoPackage which contains


two modules named mathematics and greets. The
mathematics module contains sum, average, power
functions, and the greets module contains the sayHello √
function.
i) Import the module from a package to another
program.
ii) Import a specific function from a module.

Page 6 of 62
Advanced Python Programming (DI02016011)

6 Install urllib3 package using PIP. Send HTTP requests


to any URL and print status for the same. √

7 Write a program to catch on Divide by zero Exception


with finally clause. √

8 Write a user-defined exception that could be raised


when the text entered by a user consists of less than 10 √
characters.
9 Write a python program to demonstrate exception
handling. √

10 i) Write a program to read the content of a file line by


line and write it to another file except for the lines
containing "a" letter in it.
ii) Write a program that inputs a text file. The program √
should print all of the unique words in the file in
alphabetical order.
11 Write a program to create a binary file to store Rollno
and Name, Search any Rollno and display name if
Rollno found otherwise “Rollno not found”.

12 Write a program to demonstrate the file and file I/O


operations.

13 i) Draw square, rectangle, and circle using Turtle.
ii) Draw color-filled shapes (square, rectangle, and √
circle) using Turtle.

14 Draw a smiling face emoji and rainbow using Turtle.



15 Draw an Indian Flag and an Olympic Symbol using
Turtle √

Page 7 of 62
Advanced Python Programming (DI02016011)

Industry Relevant Skills

The following industry relevant skills are expected to be developed in the students by
performance of experiments of this course.

• Student will attain expertise in Core Python


• Students will be able to write code quickly and efficiently while achieving
complex tasks
Guidelines to Course Faculty

1. Couse faculty should demonstrate experiment with all necessary implementation


strategies described in curriculum.
2. Couse faculty should explain industrial relevance before starting of each experiment.
3. Course faculty should involve & give opportunity to all students for hands on experience.
4. Course faculty should ensure mentioned skills are developed in the students by asking.
5. Utilise 2 hrs of lab hours effectively and ensure completion of write up with quiz also.
6. Encourage peer to peer learning by doing same experiment through fast learners.

Instructions for Students

1. Organize the work in the group and make record of all observations.
2. Students shall develop maintenance skill as expected by industries.
3. Student shall attempt to develop related hand-on skills and build confidence.
4. Student shall develop the habits of evolving more ideas, innovations, skills etc.
5. Student shall refer technical magazines and data books.
6. Student should develop habit to submit the practical on date and time.
7. Student should well prepare while submitting write-up of exercise.

Page 8 of 62
Advanced Python Programming (DI02016011)

Practical Rubrics

Agenda Rubric Level of Achievement


Parameters Excellent Very Good Good Poor
(4) (3) (2) (1)
Problem Understand the Able to define Able to identify Able to identify Able to identify
Understanding problem, & explain all the almost all very few
identify the concept problem/Task problem/Task and problem/ Task
concept for properly and and able to able to apply and able to apply
solution, explain able to apply all almost all concept very few concept
concept and identify concept in in problem/Task in problem/ Task.
able to identify application of problem/Task with few
application of concept. properly with 6 exceptions.
concept. +very few help.

Design Conceptual Properly Properly Properly followed Partially followed


Methodology design, Division Followed & Followed & & Not Justified and Not justified
of problem into Properly Justified partly
modules, Justified
Selection of
design
framework

Implementation Design, Properly Properly Properly followed Partially followed


Algorithm, Followed & Followed & & Not and Not
Coding Properly implemented implemented implemented
implemented partly
Demonstration Execution of Properly Properly Partially Partially
source code, demonstrated demonstrated & demonstrated & demonstrated and
Working and & Properly Partially Justified no justification
results Justified Justified output
output
Viva Handling Answered all Answered 70% Answered 50% Answered 20%
Questions questions with questions questions questions
proper
justification

Page 9 of 62
Advanced Python Programming (DI02016011)

Continuous Assessment Sheet


Enrolment No: Name: Term:

Sr Practical Outcome/Title of experiment


No. RB1 RB2 RB3 RB4 RB5 Total Date Sign
1 Write a program to demonstrate the set
functions and operations.

2 i) Write a program to input n numbers


from the user and store these numbers in a
tuple. Print the maximum and minimum
number from this tuple.
ii) Create a user-defined function that
prints a tuple whose values are the cube of
a number between 1 and n (both included),
Where n is an integer number and passed
as an argument

3 i) Write a program to count the number of


times a character appears in a given string
using a dictionary
ii) Write a user-defined function to
convert a number entered by the user into
its corresponding number in words. For
example, if the input is 789 then the output
should be ' Seven Eight Nine ‘.

4 Write a program to define a module to find


the area and circumference of a circle.
ii) import the module to another program.
ii) import a specific function from a
module to another program

5 Create a package named DemoPackage


which contains two modules named
mathematics and greets. The mathematics
module contains sum, average, power
functions, and the greets module contains
the sayHello function.
i) Import the module from a package to
another program.
ii) Import a specific function from a
module.

Page 10 of 62
Advanced Python Programming (DI02016011)

6 Install urllib3 package using PIP. Send


HTTP requests to any URL and print
status for the same.
7 Write a program to catch on Divide by
zero Exception with finally clause.
8 Write a user-defined exception that could
be raised when the text entered by a user
consists of less than 10 characters.
9 Write a python program to demonstrate
exception handling.
10 i) Write a program to read the content of a
file line by line and write it to another file
except for the lines containing "a" letter in
it.
ii) Write a program that inputs a text file.
The program should print all of the unique
words in the file in alphabetical order.
11 Write a program to create a binary file to
store Rollno and Name, Search any Rollno
and display name if Rollno found
otherwise “Rollno not found”.
12 Write a program to demonstrate the file
and file I/O operations.
13 i) Draw square, rectangle, and circle using
Turtle.
ii) Draw color-filled shapes (square,
rectangle, and circle) using Turtle.
14 Draw a smiling face emoji and rainbow
using Turtle.
15 Draw an Indian Flag and an Olympic
Symbol using Turtle

Page 11 of 62
Advanced Python Programming (DI02016011)

Practical No.1: Write a program to demonstrate the set functions and operations.

A. Objective:
Apply set functions and operations to solve particular problem.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate
a computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the
industry-identified competency:
1. Problem solving skill using set functions and operations in advanced python.

D. Expected Course Outcomes(COs)


CO1: Develop python programs by applying data structures - dictionary, tuple, and
set concepts.
E. Practical Outcome(PRO)
Write a program to demonstrate the set functions and operations.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 12 of 62
Advanced Python Programming (DI02016011)

Write a program to demonstrate the set functions and operations.

Code

Output

Page 13 of 62
Advanced Python Programming (DI02016011)

Practical No.2: i) Write a program to input n numbers from the user and store these
numbers in a tuple. Print the maximum and minimum number from this tuple.
ii) Create a user-defined function that prints a tuple whose values are the cube of a number
between 1 and n (both included), Where n is an integer number and passed as an argument.

A. Objective:
Apply tuple methods and operations to solve particular problem.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate
a computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the
industry-identified competency:
1. Problem solving skill using tuple methods and operations in advanced python.

D. Expected Course Outcomes(COs)


CO1: Develop python programs by applying data structures - dictionary, tuple, and
set concepts.
E. Practical Outcome(PRO)
Write a program to demonstrate the tuple methods and operations.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 14 of 62
Advanced Python Programming (DI02016011)

i) Write a program to input n numbers from the user and store these numbers in a tuple. Print the
maximum and minimum number from this tuple.
code

output:

Page 15 of 62
Advanced Python Programming (DI02016011)

ii) Create a user-defined function that prints a tuple whose values are the cube of a number
between 1 and n (both included), Where n is an integer number and passed as an argument.

code

output:

Page 16 of 62
Advanced Python Programming (DI02016011)

Practical No.3:
i) Write a program to count the number of times a character appears in a given string
using a dictionary
ii) Write a user-defined function to convert a number entered by the user into its
corresponding number in words. For example, if the input is 789 then the output should
be ' Seven Eight Nine’.

A. Objective:
Apply dictionary methods and operations to solve particular problems.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate
a computer based system, process, component, or program to meet the
desired needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies

C. Expected Skills to be developed based on competency:


This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using dictionary methods and operations in advanced
python.

D. Expected Course Outcomes(COs)


CO1: Develop python programs by applying data structures - dictionary, tuple, and set
concepts.
E. Practical Outcome(PRO)
Write a program to demonstrate the dictionary methods and operations.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 17 of 62
Advanced Python Programming (DI02016011)

i) Write a program to count the number of times a character appears in a given string using a
dictionary

code

output:

Page 18 of 62
Advanced Python Programming (DI02016011)

ii) Write a user-defined function to convert a number entered by the user into its corresponding
number in words. For example, if the input is 789 then the output should be ' Seven Eight Nine

code

output:

Page 19 of 62
Advanced Python Programming (DI02016011)

Practical No.4: Write a program to define a module to find the area and circumference of a
circle.
a) Import the module to another program.
b) Import a specific function from a module to another program.

A. Objective:
Define a module to find the area and circumference of a circle.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using module in advanced python.

D. Expected Course Outcomes(COs)


CO2: Develop modules and packages in python programs for modular programming
approach.
E. Practical Outcome(PRO)
Write a program to define a module to find the area and circumference of a circle.
a) import the module to another program.
b) import a specific function from a module to another program.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 20 of 62
Advanced Python Programming (DI02016011)

a) import the module to another program.

#circle.py

code

output:

Page 21 of 62
Advanced Python Programming (DI02016011)

#main.py

code

output:

Page 22 of 62
Advanced Python Programming (DI02016011)

b) Import a specific function from a module to another program.

#circle.py

code

output:

Page 23 of 62
Advanced Python Programming (DI02016011)

#main.py

code

output:

Page 24 of 62
Advanced Python Programming (DI02016011)

Practical No.5: Create a package named DemoPackage which contains two modules
named mathematics and greets. The mathematics module contains sum, average, power
functions, and the greets module contains the sayHello function.
i) Import the module from a package to another program
ii) Import a specific function from a module.

A. Objective:
Apply package and module to solve particular problem.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using package in advanced python.

D. Expected Course Outcomes(COs)


CO2: Develop modules and packages in python programs for modular programming
approach.
E. Practical Outcome(PRO)

Create a package named DemoPackage which contains two modules named


mathematics and greets. The mathematics module contains sum, average, power
functions, and the greets module contains the sayHello function.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 25 of 62
Advanced Python Programming (DI02016011)

i) Import the module from a package to another program

#DemoPackage/greets.py

code

output:

Page 26 of 62
Advanced Python Programming (DI02016011)

#DemoPackagae/maths.py
code

output:

Page 27 of 62
Advanced Python Programming (DI02016011)

main.py
code

output:

Page 28 of 62
Advanced Python Programming (DI02016011)

ii)Import a specific function from a module.

#DemoPackage/greets.py

code

output:

Page 29 of 62
Advanced Python Programming (DI02016011)

#DemoPackagae/maths.py
code

output:

Page 30 of 62
Advanced Python Programming (DI02016011)

main.py
code

output:

Page 31 of 62
Advanced Python Programming (DI02016011)

Practical No.6 Install urllib3 package using PIP. Send HTTP requests to any URL and
print status for the same.

A. Objective:

Install urllib3 package using PIP. Send HTTP requests to any URL and print
status for the same.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:

1. Skill to Install urllib3 package using PIP. Send HTTP requests to any URL and print
status for the same.

D. Expected Course Outcomes(COs)


CO2: Develop modules and packages in python programs for modular
programming approach.
E. Practical Outcome(PRO)
Install urllib3 package using PIP. Send HTTP requests to any URL and print status for
the same.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 32 of 62
Advanced Python Programming (DI02016011)

Install urllib3 package using PIP. Send HTTP requests to any URL and print status for the
same.

code

output:

Page 33 of 62
Advanced Python Programming (DI02016011)

Practical No.7 Write a program to catch on DivideByZero Exception with finally clause.

A. Objective: program to catch on Divide by zero Exception with finally clause.

B. Expected Program Outcomes (POs)


1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using error handling techniques using exception handling.

D. Expected Course Outcomes(COs)


CO3: Implement error handling techniques using exception handling.
E. Practical Outcome(PRO)
Write a program to catch on Divide by zero Exception with finally clause.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 34 of 62
Advanced Python Programming (DI02016011)

Write a program to catch on DivideByZero Exception with finally clause

code

output:

Page 35 of 62
Advanced Python Programming (DI02016011)

Practical No.8 Write a user-defined exception that could be raised when the text entered
by a user consists of less than 10 characters.

A. Objective:

Apply Exception handling to solve particular problem.


B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge:Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using exception handling in advanced python.

D. Expected Course Outcomes(COs)


CO3: Implement error handling techniques using exception handling.
E. Practical Outcome(PRO)

Write a user-defined exception that could be raised when the text entered by a user
consists of less than 10 characters.

F. Expected Affective domain Outcome(ADOs)


1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 36 of 62
Advanced Python Programming (DI02016011)

Write a user-defined exception that could be raised when the text entered by a user consists of
less than 10 characters.

code

output:

Page 37 of 62
Advanced Python Programming (DI02016011)

Practical No.9 Write a python program to demonstrate exception handling.

A. Objective:

Apply Exception handling to solve particular problem.


B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
3. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-
identified competency:
1. Problem solving skill using exception handling in advanced python.

D. Expected Course Outcomes(COs)


CO3: Implement error handling techniques using exception handling.
E. Practical Outcome(PRO)
Write a python program to demonstrate exception handling.
● Program to print the reciprocal of even numbers.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution
2. Turn off systems after completion of practical lab to save power

Page 38 of 62
Advanced Python Programming (DI02016011)

Write a python program to demonstrate exception handling.

code

output:

Page 39 of 62
Advanced Python Programming (DI02016011)

Practical No.10
i) Write a program to read the content of a file line by line and write it to another file except for
the lines containing "a" letter in it.
ii) Write a program that inputs a text file. The program should print all of the unique words in
the file in alphabetical order.

A. Objective:

i) Write a program to read the content of a file line by line and write it to another
file except for the lines containing "a" letter in it.
ii) Write a program that inputs a text file. The program should print all of the unique
words in the file in alphabetical order.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry identified
competency:
1. Problem solving skill using file input/output operations in advanced python.
D. Expected Course Outcomes(COs)
CO4: Develop python programs using file input/output operations.
E. Practical Outcome(PRO)

Write a program to read the content of file line by line and write it to another file except for
the lines containing "a" letter in it.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power.

Page 40 of 62
Advanced Python Programming (DI02016011)

i) Write a program to read the content of a file line by line and write it to another file except
for the lines containing "a" letter in it

code

output:

Page 41 of 62
Advanced Python Programming (DI02016011)

ii) Write a program that inputs a text file. The program should print all of the unique words in
the file in alphabetical order.

code

output:

Page 42 of 62
Advanced Python Programming (DI02016011)

Practical No.11 Write a program to create a binary file to store Rollno and Name,
Search any Rollno and display name if Rollno found otherwise “Rollno not found”.

A. Objective:

The objective of practical is to work with binary file and use pickle module to solve
problem.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-identified
competency:
1. Problem solving skill using file input/output operations in advanced python.

D. Expected Course Outcomes(COs)


CO4: Develop python programs using file input/output operations.
E. Practical Outcome(PRO)

Write a program to create a binary file to store Rollno and Name, Search any Rollno and
display name if Rollno found otherwise “Rollno not found”.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power.

Page 43 of 62
Advanced Python Programming (DI02016011)

Write a program to create a binary file to store Rollno and Name, Search any Rollno and display
name if Rollno found otherwise “Rollno not found”.

code

Page 44 of 62
Advanced Python Programming (DI02016011)

output:

Page 45 of 62
Advanced Python Programming (DI02016011)

Practical No.12 Write a program to demonstrate the file and file I/O operations.

A. Objective:
The objective of practical is to apply file I/O Concept.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-identified
competency:
1. Problem solving skill using file input/output operations in advanced python.
D. Expected Course Outcomes(COs)
CO4: Develop python programs using file input/output operations.
E. Practical Outcome(PRO)
Write a program to demonstrate the file and file I/O operations.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power

Page 46 of 62
Advanced Python Programming (DI02016011)

Write a program to demonstrate the file and file I/O operations.

code

Page 47 of 62
Advanced Python Programming (DI02016011)

output

Page 48 of 62
Advanced Python Programming (DI02016011)

Practical No.13
i) Draw square, rectangle, and circle using Turtle.
ii) Draw color-filled shapes (square, rectangle, and circle) using Turtle.

A. Objective:

The objective of practical is draw to square, rectangle, and circle using python
turtle module.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-identified
competency:
1. Problem solving skill using python turtle module to draw graphics in advanced python.

D. Expected Course Outcomes(COs)


CO5: Draw graphics using the turtle module.
E. Practical Outcome(PRO)
Draw square, rectangle, and circle using Turtle.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power.

Page 49 of 62
Advanced Python Programming (DI02016011)

i) Draw square, rectangle, and circle using Turtle.


code

Page 50 of 62
Advanced Python Programming (DI02016011)

output

Page 51 of 62
Advanced Python Programming (DI02016011)

ii)Draw color-filled shapes (square, rectangle, and circle) using Turtle.


code

Page 52 of 62
Advanced Python Programming (DI02016011)

output

Page 53 of 62
Advanced Python Programming (DI02016011)

Practical No.14 Draw a smiling face emoji and rainbow using Turtle.

A. Objective:
The objective of practical is to draw a smiling face emoji and rainbow using Turtle.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-identified
competency:
1. Problem solving skill using python turtle module to draw graphics in advanced
python.

D. Expected Course Outcomes(COs)


CO5: Draw graphics using the turtle module.
E. Practical Outcome(PRO)
Draw a smiling face emoji and rainbow using Turtle.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power.

Page 54 of 62
Advanced Python Programming (DI02016011)

code

Page 55 of 62
Advanced Python Programming (DI02016011)

Page 56 of 62
Advanced Python Programming (DI02016011)

output

Page 57 of 62
Advanced Python Programming (DI02016011)

Practical No.15 Draw an Indian Flag and an Olympic Symbol using Turtle.

A. Objective:
The objective of practical is to draw an Indian Flag and an Olympic Symbol using Turtle.
B. Expected Program Outcomes (POs)
1. Basic and Discipline specific knowledge: Be able to apply engineering
knowledge of computing appropriate to the problem
2. Problem Analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
3. Design/ development of solutions: Be able to design, implement, and evaluate a
computer based system, process, component, or program to meet the desired
needs
4. Engineering Tools, Experimentation and Testing: Be able to use and apply
current technical concepts and best practices in information technologies
5. Project Management: Use engineering management principles individually, as a
team member or a leader to manage projects
6. Life-long learning solution: Ability to analyse individual needs and engage in
updating in the context of technological changes.
C. Expected Skills to be developed based on competency:
This practical is expected to develop the following skills for the industry-identified
competency:
1. Problem solving skill using python turtle module to draw graphics in advanced
python.

D. Expected Course Outcomes(COs)


CO5: Draw graphics using the turtle module.
E. Practical Outcome(PRO)
Draw an Indian Flag and an Olympic Symbol using Turtle.
F. Expected Affective domain Outcome(ADOs)
1. Handle computer systems carefully with safety and necessary precaution.
2. Turn off systems after completion of practical lab to save power.

Page 58 of 62
Advanced Python Programming (DI02016011)

code

Page 59 of 62
Advanced Python Programming (DI02016011)

Page 60 of 62
Advanced Python Programming (DI02016011)

Page 61 of 62
Advanced Python Programming (DI02016011)

output

Page 62 of 62

You might also like