ISL56 Python Lab - EXAM-FINAL-QB
ISL56 Python Lab - EXAM-FINAL-QB
2. CONTROL STRUCTURES:
1. Read your email id and write a program to display the no of vowels, consonants,
digits and white spaces in it using if…elif…else statement.
2. Find the sum of all the primes below two million.
3. LIST:
1. Read a list of numbers and print the numbers divisible by x but not by y (Assume x
= 4 and y = 5).
2. Read a list of numbers and print the sum of odd integers and even integers from
the list.(Ex: [23, 10, 15, 14, 63], odd numbers sum = 101, even numbers sum =
24)
3. Read a list of numbers and print numbers present in odd index position. (Ex: [10,
25, 30, 47, 56, 84, 96], The numbers in odd index position: 25 47 84).
4. Read a list of numbers and remove the duplicate numbers from it. (Ex: Enter a list
with duplicate elements: 10 20 40 10 50 30 20 10 80, The unique list is: [10, 20,
30, 40, 50, 80])
4. TUPLES:
1. Given a list of tuples. Write a program to find tuples which have all elements
divisible by K from a list of tuples. test_list = [(6, 24, 12), (60, 12, 6), (12, 18,
21)], K = 6, Output: [(6, 24, 12), (60, 12, 6)]
2. Given a list of tuples. Write a program to filter all uppercase characters’ tuples
from given list of tuples. (Input: test_list = [(“GFG”, “IS”, “BEST”), (“GFg”,
“AVERAGE”), (“GfG”,), (“Gfg”, “CS”)], Output: [(„GFG‟, „IS‟,
3. „BEST‟)]).
4. Given a tuple and a list as input, write a program to count the occurrences of all
items of the list in the tuple. (Input : tuple = ('a', 'a', 'c', 'b', 'd'), list = ['a', 'b'],
Output : 3)
5. DICTIONARY:
1. Write a program to do the following operations:
o Create a empty dictionary with dict() method
o Add elements one at a time
o Update existing key‟s value
o Access an element using a key and also get() method
o Deleting a key value using del() method
2. Write a program to create a dictionary and apply the following methods:
o pop() method
o popitem() method
o clear() method
3. Given a dictionary, write a program to find the sum of all items in the dictionary.
4. Write a program to merge two dictionaries using update() method.
6. OOPS:
a) Create a class called CAR, data members ( model_name, color, price, top_speed)
method: read above details using constructor (__int__) and without constructor.
Display above detail
Method:
__init__()
Display()
Branch_name, Branch_name,
IFSC_Code, IFSC_Code,
Method: Method:
__init__() __init__()
Display() Display()
7. OOPS:
Write python program class TIME member hour, minute, second
add two TIME object by using operator overloading [by using __add__ () magic method]
subtract add two TIME object by using operator overloading [by using __sub__ () magic
method.
8. FILE HANDLING:
1. Write a program to read a filename from the user, open the file (say firstFile.txt)
and then perform the following operations:
Count the sentences in the file.
Count the words in the file.
Count the characters in the file.
2. Create a new file (Hello.txt) and copy the text to other file called target.txt. The
target.txt file should store only lower case alphabets and display the number of
lines copied.
3. Write a Python program to store N student‟s records containing name, roll number
and branch. Print the given branch student‟s details only.
9. STRINGS:
PART B
1. Python statistics module for given data set (label x, label y) (.csv or .xlsx file formats)
i. Scatter all point graph by matplotlib
ii. Calculates the mean (average) of the given data set
iii. Calculates the median (middle value) of the given data.
iv. Calculates the standard deviation.
v. Calculates the variance.
vi. Calculate slop btw points
vii. Draw regression line
3. Write Python program result analysis with data visualization on (Pandas, Matplotlib
Seaborn)
Read data from the given result file (.csv format or excel format)
Count the number of pass, and fail each subject and the overall result analyze [ by
using list and dictionary data type]
Visualize output (Scatter Plot, Line Chart, Bar Chart, Histogram, etc)
Course outcomes:
At the end of the course, the student will be able to:
Use internal and external Python libraries, data structures, and functions inherent to Python in-
order to handle data. (PO-1, 2, 5, 6, 9,10,12) (PSO-1, 2, 3)
Identify object-oriented programming constructs for developing large, modular and Apply
reusable real-time programs. (PO-1, 2, 5, 6, 9,10,12) (PSO-1, 2, 3)
Apply Python as a scripting language to analyze huge datasets, and apply data science related
statistics to datasets. (PO-1, 2, 5, 6, 9,10, 12) (PSO-1, 2, 3)
Note: Execute one full question from part A and question part B
Part A (25 Marks) Part B (25 Marks)
Procedure Write Up 5 5
Execution 16 16
Viva 4 4