0% found this document useful (0 votes)
2 views2 pages

Python Sem1 Questions

The document contains a series of programming tasks in Python, covering various topics such as string manipulation, list processing, dictionary merging, and data visualization using Matplotlib. Each task specifies requirements and examples, ranging from checking for consecutive vowels to implementing a mini library system and simulating a banking system with OOP principles. The tasks are designed to test and enhance coding skills across different areas of Python programming.

Uploaded by

theanshu415
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python Sem1 Questions

The document contains a series of programming tasks in Python, covering various topics such as string manipulation, list processing, dictionary merging, and data visualization using Matplotlib. Each task specifies requirements and examples, ranging from checking for consecutive vowels to implementing a mini library system and simulating a banking system with OOP principles. The tasks are designed to test and enhance coding skills across different areas of Python programming.

Uploaded by

theanshu415
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Write a one-line Python expression that checks whether a string s contains at least
two consecutive vowels (e.g., "ae", "oo") using only slicing + any().(1 Marks)
2. Write Python code to extract all palindromic substrings from a given string (length ≥
2). (Example: "abbaeae" → "bb", "abba", "aea", "aeaea")(2 Marks)
3. Given a list of integers, write code to remove every element that is part of a strictly
increasing triplet (No extra list allowed.) (2 Marks)
4. Without using replace(), reverse(), or slicing, write Python code to reverse a string
using only a loop and string concatenation.(2 Marks)
5. Write a Python program to rotate a list to the right by k positions WITHOUT slicing,
extra lists, or built-ins — only manual shifting element by element.(3 Marks)
6. Write code that removes all nested duplicate values from a nested list of arbitrary
depth. Example: Input: [1, [2, 3, [3, 4, 2]], 1, [2, 3]] → Output: [1, [2, 3, [4]], [2]].(3
Marks)
7. Write a function that takes a string and removes characters that appear more than
the average frequency of all characters.(3 Marks)
8. Write Matplotlib code to generate a 3-subplot vertical figure where: Subplot 1 →
reversed x,y line plot, Subplot 2 → y values smoothed manually using a custom
moving-average function, Subplot 3 → derivative (difference between consecutive y
values).(3 Marks)
9. Write Python code to deeply merge two dictionaries recursively where numeric
values must be added, strings concatenated, and nested dictionaries merged using
the same rule. Example: Input: d1 = {"a": {"x": 1}, "b": "hi"} and d2 = {"a": {"x": 4, "y":
2}, "b": "bye"} → Output: {"a": {"x": 5, "y": 2}, "b": "hibye"}.(4 Marks)
10. Write Python code to compute the transpose, row sums, column sums, and
diagonal sums of a matrix represented as a list of lists WITHOUT using extra lists
except for the final output.(4 Marks)
11. Write a Python program to implement a mini library system using OOP with class
Book and class Library where Library can add, remove, search (partial allowed)
books and count books per author. Demonstrate all methods.(4 Marks)
12. Write Matplotlib code to: generate 400 random points, create a contour plot using
manually computed 2D grid (no numpy), overlay scatter plot, set custom ticks, and
remove top/right borders.(4 Marks)
13. Write an OOP-based program to simulate a banking system with Account,
SavingsAccount(inherits), Transaction(logging), Bank(storing accounts).
Requirements: prevent negative balance, maintain transaction history, print latest 5
transactions.(5 Marks)
14. Write Matplotlib code to: generate a noisy sine wave using [Link](), create
custom smoothing using moving-average and manual median filter, and plot raw,
smoothed, and median-filtered versions with legend, title, grid, and custom ticks.(5
Marks)
15. Write a Python program that reads a paragraph, manually splits into sentences
using punctuation, then finds: longest sentence, highest digit count sentence, and
sentence with max repeated word density. Print sentences along with index. (5
Marks)

You might also like