ABES Engineering College, Ghaziabad
Department of Computer Science
Session: 2025-26 Semester:3rd Branch/Section: CSE/All
Course Code: BCC 302 Course Name: Python Programming
Max. Marks: 10
Class Test-1/ Assignment 1
Date of Assignment/Test: 3-Sept-2025 Date of submission(for Assignment only): 8-Sept-2025
[Link]. Question CO KL Marks
Find and explain stepwise solution of following expressions if CO1 K3
1 a=3, b=5, c=10. 2
i) a &b<<2//5**2+c^b
ii) b>>a**2<<2 >> b**2^c**3
2 Differentiate between python list and arrays CO1 K3 2
Consider the program : CO1 K3
X=[‘hello’, ‘12’, 456]
3 X[0]*=3 2
X[1][1]=’bye’
What is the output of the above mentioned code?
If there is an error then explain why?
4 Explain history and features of python while comparing CO1 K2 2
python version 2 and 3
5 How are python numeric data types declared and used in CO1 K2 2
python
ABES Engineering College, Ghaziabad
Department of Computer Science Engineering
Session: Semester:3rd Branch/Section: CSE/All
2025-26
Course Course Name: Python Programming
Code: BCC
302
Max. Marks: 10
Assignment 2
Date of Assignment/Test: 04-Nov-2025 Date of submission: 06-Nov-2025
[Link] Description CO BL
a) What is the purpose of the elif statement in Python? How does it differ
1 CO2 K2
from ifand else, and why is it important for handling multiple conditions?
b) Discuss the basic structure of a for loop and for-else in Python. How do
youiterate over a sequence or collection using a for loop?
Develop a Python program that uses a while loop to simulate a basic guessing
2 game. The program should generate a random number, and the user should
CO2 K3
guessit. The game should provide feedback on whether the guess is too high or
too lowuntil the correct number is guessed.
Implement a program that prints the following pattern:
3 a) b)
CO2 K3
a)Create a program that generates and prints the first N prime numbers, where
N is input by the user.
4 b) Develop a program that takes a string input from the user and counts the
CO2 K3
numberof vowels (a, e, i, o, u) in the string using a for loop.
a) Explain how the continue statement works in a loop. Provide an example of
5 how you might use continue to skip certain iterations.
CO2 K1
b) Describe the role of the pass statement in Python loops. In what situations
wouldyou use it, and how does it affect program flow?
a) a) Create a Python program that checks if a given year is a leap year or not. Use
6 CO2 K3
conditional statements to determine the leap year criteria.
b) b) Write a Python program that asks the user to enter a series of numbers. Use a
while loop to continue prompting for input until the user enters the number 42.
When 42 is entered, terminate the loop using the break statement.
a) Write a Python program that calculates the sum of all even numbers from 1 to
7 100using a for loop. CO2 K3
b) Write a Python program to find the nth Fibonacci number
a) Create a program that takes a list of numbers as input and calculates their
8 product using for loop.
CO2 K3
b) Create a program that prints all even numbers between 1 and 20 using a for
loop,but skips the number 10 using the continue statement.
a) Write a Python program that repeatedly asks the user for a number until they
9 enter 0. Afterward, calculate and print the sum of all entered numbers using a while CO2 K3
loop.
b) Implement a program that checks whether a given list contains a specific
value. Ifthe value is found, print a message and exit the loop early using the
else clause.
a) Write a Python program to print a pattern of asterisks in the shape of a right-
10 angled triangle. Allow the user to input the height of the triangle. CO2 K3
b) Create a program that prints a pattern of numbers in the form of a Pascal's
triangle. Allow the user to input the number of rows for the triangle.
ABES Engineering College, Ghaziabad
Department of Computer Science Engineering
Session: 2025-26 Semester:3rd Branch/Section: CSE/All
Course Code: BCC 302 Course Name: Python Programming
Assignment 3
Date of Assignment/Test: 04-Nov-2025 Date of submission: 06-Nov-2025
[Link] Description CO BL
1 CO3 K3
Construct a function ret smaller(l) that returns smallest list from a
nested list. If two lists have same length then return the first list
that is encountered. For example:
ret smaller([ [ -2, -1, 0, 0.12, 1, 2], [3, 4, 5], [6 , 7, 8, 9, 10], [11,
12, 13, 14, 15]]) returns [3,4,5]
ret smaller([ [ -2, -1, 0, 0.12, 1, 2], [‘a’, ’b’, ’c’, ’d’, 3, 4, 5], [6 , 7,
8, 9, 10], [11, 12, 13, 14, 15]]) returns [6 , 7, 8, 9, 10]
2 CO3 K2
Explain Tuples and Unpacking Sequences in Python Data
Structure.
3 CO3 K3
Write a Python program to get a list, sorted in increasing order by
the last element in each tuple from a given list of non-empty tuples.
Sample List: [(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]
Expected Result: [(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)]
4 Develop a Python function that removes duplicates from a list while CO3 K3
maintaining the original order.
5 CO3 K3
When to Use Python Lists and when to Use Tuples, Dictionaries or
Sets.
6 Find all of the numbers from 1-1000 that are divisible by 7 using list CO3 K3
comprehension
Write a program that merges two dictionaries and handles duplicate CO3 K3
7 keys intelligently.
8 Illustrate different list slicing constructs for the following operations CO3 K3
on the following list: L = [1, 2, 3, 4, 5, 6, 7, 8, 9]
1. Return a list of numbers starting from the last to second item of the
list
2. Return a list that start from 3rd item to second last item.
3. Return a list that has only even position elements of list L to list M.
4. Return a list that starts from the middle of the list L.
5. Return a list that reverses all the elements starting from element at
index 0 to middle index only and return the entire list.
9 Write a Python function to count the frequency of each character in a CO3 K3
given string and return the output in a dictionary. Example:
char_frequency("HELLO") returns {"H":1, "E":1, "L":2, "O":1}
10 Write a Python program to demonstrate CRUD operation on CO3 K3
dictionary
ABES Engineering College, Ghaziabad
Department of Computer Science Engineering
Session: 2025-26 Semester:3rd Branch/Section: CSE/All
Course Code: BCC 302 Course Name: Python Programming
Assignment 5
Date of submission: 15th -Dec-2025
[Link] Description CO BL
Change all the numbers in the file to text.
1 Construct a program for the same. CO2 K2
Example:
Given 2 integer numbers, return their product only
if the product is equal to or lower than 10.
And the result should be:
Given two integer numbers, return their product
only if the product is equal to or lower than one
zero
Construct a program which accepts a sequence of
2 words separated by whitespace as file input. Print CO2 K2
the words composed of digits only.
Write a program to accept string/sentences from the
user till the user enters “END” to. Save the data
3 in a text file and then display only those CO2 K3
sentences which begin with an uppercase alphabet.
Define pickling in Python. Explain serialization
4 and CO2 K3
deserialization of Python object.
ABES Engineering College, Ghaziabad
Department of Computer Science Engineering
Session: 2025-26 Semester:3rd Branch/Section: CSE/All
Course Code: BCC 302 Course Name: Python Programming
Assignment 5
Date of submission: 15th -Dec-2024
[Link] Description CO BL
1 CO2 K2
Create a NumPy array with random integers and write a function to
find the mean, median, and standard deviation of the array.
2 CO2 K2
Load a CSV file into a Pandas DataFrame and display basic
statistics (mean, median, std) for a specific column. Explain the
concept of merging and joining in Pandas with suitable examples.
3 CO2 K3
4 CO2 K3