Sri Indu Python Programming Lab 2
Sri Indu Python Programming Lab 2
ON
I B.Tech II-SEMESTER
A.Y.: 2022-2023
Prepared by
Mr. P. BALU
Assistant Professor
Name of the Physical PYTHON PROGRAMMING LABORATORY
laboratory:
Course code CS201ES
Room No D-107
Name of the lab incharge Mrs M. TEJASWI
Name of the faculty incharge Mr.P.BALU Assistant Professor
Mission:
To develop trained graduates with strong academic and technical skills of modern
computer science and engineering.
PEO2: To promote trained graduates with leadership qualities and the ability to solve real
time problems using current techniques and tools in interdisciplinary environment.
PEO3: To motivate the graduates towards lifelong learning through continuing education
and professional development.
PROGRAMME OUTCOMES
I Year II Semester
S. Course
Course Title L T P Credits
No. Code
1. Ordinary Differential Equations and Vector 3 1 0 4
MA201BS Calculus
2. CH203BS Engineering Chemistry 3 1 0 4
3. ME201ES Computer Aided Engineering Graphics 1 0 4 3
4. EE201ES Basic Electrical Engineering 2 0 0 2
5. EC201ES Electronic Devices and Circuits 2 0 0 2
6. CH206BS Engineering Chemistry Laboratory 0 0 2 1
7. EE202ES Basic Electrical Engineering Laboratory 0 0 2 1
8. CS201ES Python Programming Laboratory 0 1 2 2
9. CS203ES IT Workshop 0 0 2 1
Total 11 3 12 20
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution under UGC)
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956
(Approved by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
0 1 2 2
Course Objectives:
Week -1:
1. i) Use a web browser to go to the Python website http://python.org. This page contains information
about Python and links to Python-related pages, and it gives you the ability to search the Python
documentation.
ii) Start the Python interpreter and type help() to start the online help utility.
2. Start a Python interpreter and use it as a
Calculator.
3.
i) write a program to calculate compound interest when principal, rate and number of
periods aregiven.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two points
4. Read name, address, email and phone number of a person through keyboard and print the
details.
Week - 2:
1. Print the below triangle using for loop.
5
44
333
2222
11111
2. Write a program to check whether the given input is digit or lowercase character or
uppercase character or a special character (use 'if-else-if' ladder)
3. Python Program to Print the Fibonacci sequence using while loop
4. Python program to print all prime numbers in a given interval (use break)
Week - 3:
1. i) Write a program to convert a list and tuple into arrays.
ii) Write a program to find common values between two arrays.
2. Write a function called gcd that takes parameters a and b and returns their greatest common
divisor.
3. Write a function called palindrome that takes a string argument and returns True if it is a
palindromeand False otherwise. Remember that you can use the built-in function len to check
the length of a string.
Week - 4:
1. Write a function called is_sorted that takes a list as a parameter and returns True if the list is
sorted in ascending order and False otherwise.
2. Write a function called has_duplicates that takes a list and returns True if there is any element
thatappears more than once. It should not modify the original list.
i). Write a function called remove_duplicates that takes a list and returns a new list with only theunique
elements from the original. Hint: they don’t have to be in the same order.
ii).The wordlist I provided, words.txt, doesn’t contain single letter words. So you might want toadd
“I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct a function to invertits
content. i.e., keys should be values and values should be keys.
3. i) Add a comma between the characters. If the given word is 'Apple', it should become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the first letter
of everyword with the corresponding upper case letter and the rest of the letters in the word
bycorresponding letters in lower case without using a built-in function?
4. Writes a recursive function that generates all binary strings of n-bit length
Week - 5:
1. i) Write a python program that defines a matrix and prints
ii) Write a python program to perform addition of two square matrices
iii) Write a python program to perform multiplication of two square matrices
2. How do you make a module? Give an example of construction of a module using different
geometrical shapes and operations on them as its functions.
3. Use the structure of exception handling all general purpose exceptions.
Week-6:
1. a. Write a function called draw_rectangle that takes a Canvas and a Rectangle as
arguments and draws a representation of the Rectangle on the Canvas.
b. Add an attribute named color to your Rectangle objects and modify draw_rectangleso
that ituses the color attribute as the fill color.
c. Write a function called draw_point that takes a Canvas and a Point as arguments and
draws are presentation of the Point on the Canvas.
d. Define a new class called Circle with appropriate attributes and instantiate a few
Circle objects.Write a function called draw_circle that draws circles on the canvas.
2. Write a Python program to demonstrate the usage of Method Resolution Order (MRO)
in multiple levels of Inheritances.
3. Write a python code to read a phone number and email-id from the user and
validate it forcorrectness.
Week- 7
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to check for given words
present init and display on found.
3. Write a Python code to Read text from a text file, find the word with most number of occurrences
4. Write a function that reads a file file1 and displays the number of words, number of
vowels, blankspaces, lower case letters and uppercase letters.
Week - 8:
1. Import numpy, Plotpy and Scipy and explore their functionalities.
2. a) Install NumPy package with pip and explore it.
3. Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
4. Write a program to implement Half Adder, Full Adder, and Parallel Adder
5. Write a GUI program to create a window wizard having two text labels, two text fields and two
buttons as Submit and Reset.
TEXT BOOKS:
1. Supercharged Python: Take your code to the next level, Overland
2. Learning Python, Mark Lutz, O'reilly
REFERENCE BOOKS:
1. Python Programming: A Modern Approach, Vamsi Kurama, Pearson
2. Python Programming A Modular Approach with Graphics, Database, Mobile, and
WebApplications, Sheetal Taneja, Naveen Kumar, Pearson
3. Programming with Python, A User’s Book, Michael Dawson, Cengage Learning,
India Edition
4. Think Python, Allen Downey, Green Tea Press
5. Core Python Programming, W. Chun, Pearson
6. Introduction to Python, Kenneth A. Lambert, Cengage.
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution under UGC)
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956
(Approved by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
COURSE OUTCOMES
CO No DESCRIPTION
C128.1 Develop the application specific codes using python. (Applying)
C128.5 Evaluate programs using Python standard library, file I/O. ( Evaluating)
PO/PSO/
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO
C128.1 3 2 - 1 - - - - - - - 1 2 3
C128.2 3 - - 1 2 - - - - - - 1 - 2
C128.3 3 2 - 1 - - - - 2 - 2 1 1 -
C128.4 - 3 - 1 2 - - - - - - 1 - -
C128.5 - 3 - 1 - - - - - - 1 1 1
C128.6 - - 3 1 2 - - - 2 - 2 1 2 1
C128 3 2.5 3 1 2 2 2 1 1.5 1.7
- - - -
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956
(Approved by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
S.
Name of The Experiment CO PO
No
1. i) Use a web browser to go to the Python website http://python.org. This page
contains information about Python and links to Python-related pages, and it gives
ii) Start the Python interpreter and type help() to start the online help utility.
4. Read name, address, email and phone number of a person through keyboard and
print the details.
5
44
333
2222 PO1,PO2,PO4
2 CO1 ,PO12,PSO1,P
11111
SO2
2.Write a program to check whether the given input is digit or lowercase character or
uppercase character or a special character (use 'if-else-if' ladder)
4.Python program to print all prime numbers in a given interval (use break)
3. Write a function called palindrome that takes a string argument and returnsTrue if it
is a palindrome and False otherwise. Remember that you can use the built-in
function len to check the length of a string.
1. Write a function called is_sorted that takes a list as a parameter and returns True
if the list is sorted in ascending order and False otherwise.
2. Write a function called has_duplicates that takes a list and returns True if there is
any element that appears more than once. It should not modify the original list.
i). Write a function called remove_duplicates that takes a list and returns a new list
with only the unique elements from the original. Hint: they don’t have to be in the
same order.
ii). The wordlist I provided, words.txt, doesn’t contain single letter words. So
you might want to add “I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct a PO1,PO2,PO4,
4 function to invert its content. i.e., keys should be values and values should be PO5,PO9,PO1
CO2,CO3
keys. 1,PO12,PSO1P
3. i) Add a comma between the characters. If the given word is 'Apple', it should SO2
become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the
first letter of every word with the corresponding upper case letter and the rest of
the letters in the word by corresponding letters in lower case without using a built-
in function?
4. Writes a recursive function that generates all binary strings of n-bit length
PO2,PO4,PO5,
5 iii) Write a python program to perform multiplication of two square matrices CO4, CO5 PO12,PSO1,PS
2. How do you make a module? Give an example of construction of a module using O2
different geometrical shapes and operations on them as its functions.
3. Write a python code to read a phone number and email-id from the user and
validate it for correctness.
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to check for PO1,PO2,PO4,
7 given words present in it and display on found. CO2,CO5 PO5,PO12,PS
3. Write a Python code to Read text from a text file, find the word with most O1,PSO2
number of occurrences
1. Import numpy, Plotpy and Scipy and explore their functionalities.
5. Write a GUI program to create a window wizard having two text labels, two text
fields and two buttons as Submit and Reset.
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
UGC Autonomous Institution, Accredited by NAAC with A+ Grade
Recognized under 2(f) of UGC Act 1956. X3
(Approved by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Sheriguda(V), Ibrahimpatnam(M), R.R Dist., Telangana – 501 510 BR22
Python Programming Lab
Year & Semester: I YR II sem Branch: CSE (IOT) Subject Name: Python Programming Lab
Faculty Name: P. BALU
2. Write a function called draw_rectangle that takes a Canvas and a Rectangle as arguments and
draws a representation of the Rectangle on the Canvas.
SET-3
1. Add an attribute named color to your Rectangle objects and modify draw_rectangle so
that ituses the color attribute as the fill color.
2. Write a function called draw_point that takes a Canvas and a Point as arguments and draws a
representation of the Point on the Canvas.
SET-4
1. Define a new class called Circle with appropriate attributes and instantiate a few Circle
objects.Write a function called draw_circle that draws circles on the canvas.
2. Write a Python program to demonstrate the usage of Method Resolution Order (MRO)
in multiplelevels of Inheritances.
SET-5
1. Write a python code to read a phone number and email-id from the user and
validate it forcorrectness.
2. Write a Python code to merge two given file contents into a third file.
SET-6
1. Write a Python code to open a given file and construct a function to check for given words present
init and display on found.
2. Write a Python code to Read text from a text file, find the word with most number of occurrences
SET-7
1. Write a function that reads a file file1 and displays the number of words, number of
vowels, blankspaces, lower case letters and uppercase letters.
2. Import numpy, Plotpy and Scipy and explore their functionalities.
3. a) Install NumPy package with pip and explore it.
SET-8
1. Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
2. Write a GUI program to create a window wizard having two text labels, two text fields and
two buttonsas Submit and Reset.
SET 9
1. Start a Python interpreter and use it as a
Calculator.
2.
i) Write a program to calculate compound interest when principal, rate and number of
periods aregiven.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two points
iii) Read name, address, email and phone number of a person through keyboard and print the details.
SET 10
1. Print the below triangle using for
loop.5
44
333
2222
11111
2. Write a program to check whether the given input is digit or lowercase character or
uppercasecharacter or a special character (use 'if-else-if' ladder)
3. Python Program to Print the Fibonacci sequence using while loop
SET 11:
1. Python program to print all prime numbers in a given interval (use break)
3. Write a function called gcd that takes parameters a and b and returns their greatest common divisor.
SET 12:
1. Write a function called palindrome that takes a string argument and returnsTrue if it is a
palindromeand False otherwise. Remember that you can use the built-in function len to
check the length of a string.
2. Write a function called is_sorted that takes a list as a parameter and returns True if the list
is sortedin ascending order and False otherwise.
3. Write a function called has_duplicates that takes a list and returns True if there is any
element thatappears more than once. It should not modify the original list.
i). Write a function called remove_duplicates that takes a list and returns a new list with
only theunique elements from the original. Hint: they don’t have to be in the same order.
ii). The wordlist I provided, words.txt, doesn’t contain single letter words. So you might
want to add“I”, “a”, and the empty string.
iii). Write a python code to read dictionary values from the user. Construct a function to
invert itscontent. i.e., keys should be values and values should be keys.
SET 13:
1 i) Add a comma between the characters. If the given word is 'Apple', it should become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the first letter of
everyword with the corresponding upper case letter and the rest of the letters in the word
by corresponding letters in lower case without using a built-in function?
2. Writes a recursive function that generates all binary strings of n-bit length
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution under UGC)
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956 (Approved
by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
Examination Branch
A.Y. : 2022-23 SEM-II
Total Remarks
Sessio No of
DATE Day Branch HT.No Internal
n Student External Examiner
Examiner
s
22X31A0566
19-08-2023 SATURDAY
CSE-B FN TO 65 D.SWAPNA MD.SIRAJULHUQ
22X31A05D0
22X31A6201
21-08-2023 MONDAY CYBER
SECURITY
FN TO 62 P.BALU CHANDRA SHEKAR
22X31A6262
22X31A6601
21-08-2023 MONDAY AI&ML-A AN TO 50 M.TEJASWI CHANDRA SHEKAR
22X31A6650
22X31A6701
22-08-2023 TUESDAY DS FN TO 64 P.BALU G.SWAPNA
22X31A6764
22X31A7201
22-08-2023 TUESDAY AI&DS AN TO 64 M.TEJASWI G.SWAPNA
22X31A7264
22X31A0501
23-08-2023 WEDNESDAY CSE-A FN TO 65 D.SWAPNA A.SUNITHA
22X31A0565
22X31A0101
23-08-2023 WEDNESDAY CIVIL AN TO 02 B.RAJESHWARI A.SUNITHA
22X31A0103
22X31A05D1
24-08-2023 THURSDAY CSE-C FN TO 61 J.PUJITHA G.SWAPNA
22X31A05J1
22X31A6651
CHAINTANYA
24-08-2023 THURSDAY AI&ML-B AN TO 47 M. TEJASWI
22X31A6697 BHARATHI
22X31A6901
25-08-2023 FRIDAY IOT FN TO 63 P.BALU S.SHIVA SHANKAR
22X31A6963
FN : 9.40 am to 12.25 pm
AN : 1.00 pm to 4.00 pm
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956 (Approved
by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956 (Approved
by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956 (Approved
by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
Do’s
2. Remove your shoes or wear foot socks before you enter the lab.
7. Read and understand how to carry out an activity thoroughly before coming to the lab.
8. Write In time, Out time and system details in the login register
Don’ts
5. Do not install or download any software or modify or delete any system files on any lab computers
6. Do not disturb your neighbouring students. They may be busy in completing tasks.
Accredited by NAAC with A+ Grade, Recognized under 2(f) of UGC Act 1956 (Approved
by AICTE, New Delhi and Affiliated to JNTUH, Hyderabad)
Khalsa Ibrahimpatnam, Sheriguda (V), Ibrahimpatnam (M), Ranga Reddy Dist., Telangana – 501 510
Website: https://siiet.ac.in/
https://drive.google.com/file/d/1ZAv1g7UzRzYoDoZrAqmvDoqRKzSnJvOr/view?usp=sharing
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
58 58 58
Number of students attempted
CO - 1 y y Y
CO - 2 y y Y
CO - 3 y y Y
CO - 4
CO - 5
CO - 6
Attainment
CO Intrnal practical E+E+R OveralI Level
Level
CO-1 98% 98% 98% 3 1 40%
CO-2 98% 98% 98% 3 2 50%
CO-3 98% 98% 98% 3 3 >60%
CO-4
CO-5
CO-6
Attainment (Internal 1 Examination) = 3
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
Department of Humanities and Sciences
38 22X31A6938 10 7 10 10
39 22X31A6939 10 8 7 10
40 22X31A6940 10 8 8 10
41 22X31A6941 9 8 8 10
42 22X31A6942 9 8 7 10
43 22X31A6943 9 7 8 10
44 22X31A6944 10 8 9 10
45 22X31A6945 9 7 8 10
46 22X31A6946 9 8 8 10
47 22X31A6947 9 8 9 10
48 22X31A6948 9 7 10 10
49 22X31A6949 9 8 8 10
50 22X31A6950 9 8 9 10
51 22X31A6951 9 8 8 10
52 22X31A6952 10 7 8 10
53 22X31A6953 9 7 8 10
54 22X31A6954 10 8 8 10
55 22X31A6955 9 7 8 10
56 22X31A6956 10 7 7 10
57 22X31A6957 9 7 8 10
58 22X31A6958 9 8 9 10
59 22X31A6959 7 8 8 10
60 22X31A6960 9 7 8 10
61 22X31A6961 7 7 9 10
62 22X31A6962 9 7 8 10
63 22X31A6963 9 7 7 10
64
65
58 57 53 58
Number of students performed above the target
58 58 58 58
Number of students attempted
Intrnal
CO practical
E+E+R ppt OveralI Level
CO-1
CO-2
CO-3
CO-4 99% 91% 91% 94% 3
CO-5 99% 91% 91% 94% 3
CO-6 99% 91% 91% 94% 3
Attainment (Internal 2 Examination) = 3
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
Department of Humanities and Sciences
Course Outcome Attainment (University Examinations)
Name of the faculty: P. BALU Academic Year: 2022-23
Branch & Section: CSE(IOT) Year / Semester: I -II SEM
Lab Course Name: PYTHON PROGRAMMING
S.No Roll Number Marks Secured S.No Roll Number Marks Secured
1 21X3A6901 57 35 21X3A6935 53
2 21X3A6902 41 36 21X3A6936 58
3 21X3A6903 56 37 21X3A6937 45
4 21X3A6904 55 38 21X3A6938 46
5 21X3A6905 43 39 21X3A6939 57
6 21X3A6906 56 40 21X3A6940 55
7 21X3A6907 38 41 21X3A6941 54
8 21X3A6908 39 42 21X3A6942 48
9 21X3A6909 54 43 21X3A6943 49
10 21X3A6910 56 44 21X3A6944 53
11 21X3A6911 58 45 21X3A6945 55
12 21X3A6912 44 46 21X3A6946 37
13 21X3A6913 55 47 21X3A6947 56
14 21X3A6914 36 48 21X3A6948 55
15 21X3A6915 54 49 21X3A6949 57
16 21X3A6916 56 50 21X3A6950 39
17 21X3A6917 38 51 21X3A6951 47
18 21X3A6918 32 52 21X3A6952 49
19 21X3A6919 52 53 21X3A6953 48
20 21X3A6920 35 54 21X3A6954 49
21 21X3A6921 38 55 21X3A6955 47
22 21X3A6922 58 56 21X3A6956 48
23 21X3A6923 55 57 21X3A6957 56
24 21X3A6924 53 58 21X3A6958 57
25 21X3A6925 51 59 21X3A6959 56
26 21X3A6926 48 60 21X3A6960 38
27 21X3A6927 57 61 21X3A6961 48
28 21X3A6928 58 62 21X3A6962 49
29 21X3A6929 57 63 21X3A6963 57
30 21X3A6930 41
31 21X3A6931 56
32 21X3A6932 55
33 21X3A6933 43
34 21X3A6934 56
Class Average mark Attainment
47 Level % students
Number of students performed above the target 25 1 40%
Number of successful students 58 2 50%
Percentage of students scored more than target 43% 3 >60%
Attainment level 1
SRI INDU INSTITUTE OF ENGINEERING AND TECHNOLOGY
Department of Humanities and Sciences
Course Outcome Attainment
1st
Course Outcomes Internal 2nd Internal Internal
Exam Exam Exam University Exam Attainment Level
CO-PO mapping
PSO PSO
PO/PSO/ CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
1 2
C128.1 3 2 - 1 - - - - - - - 1 2 3
C128.2 3 - - 1 2 - - - - - - 1 - 2
C128.3 3 2 - 1 - - - - 2 - 2 1 1 -
C128.4 - 3 - 1 2 - - - - - - 1 - -
C128.5 - 3 - 1 - - - - - - 1 1 1
C128.6 - - 3 1 2 - - - 2 - 2 1 2 1
C128 3 2.5 3 1 2 - - - 2 - 2 1 1.5 1.7