0% found this document useful (0 votes)
4 views3 pages

Python 150 Code - Part 2

The document contains a list of 50 commonly asked Python interview problems categorized into various topics such as Strings & Text Processing, Lists/Arrays/Collections, Logic/Algorithmic Thinking, and more. Each problem includes a brief description of the task to be accomplished, such as finding the longest palindromic substring or implementing multithreading. This resource aims to help individuals prepare for Python-related interviews by practicing these coding challenges.
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)
4 views3 pages

Python 150 Code - Part 2

The document contains a list of 50 commonly asked Python interview problems categorized into various topics such as Strings & Text Processing, Lists/Arrays/Collections, Logic/Algorithmic Thinking, and more. Each problem includes a brief description of the task to be accomplished, such as finding the longest palindromic substring or implementing multithreading. This resource aims to help individuals prepare for Python-related interviews by practicing these coding challenges.
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

PYTHON 150 CODE

PART – 2
PYTHON 150 CODE(PART 2)
50 MOST ASKED PYTHON INTERVIEW PROBLEMS

STRINGS & TEXT PROCESSING

51. Write a program to find the longest palindromic substring in a given string.
52. Write a program to check if one string is a rotation of another string.
53. Write a program to compress a string using character counts (e.g., aaabb → a3b2).
54. Write a program to find all permutations of a string.
55. Write a program to find the most frequent substring of length K.

LISTS / ARRAYS / COLLECTIONS

56. Write a program to find the maximum subarray sum (Kadane’s Algorithm).
57. Write a program to move all zeros to the end of a list.
58. Write a program to find the equilibrium index of an array.
59. Write a program to find all pairs in a list whose sum equals a given value.
60. Write a program to merge overlapping intervals.

LOGIC / ALGORITHMIC THINKING

61. Write a program to generate all prime numbers up to N using Sieve of Eratosthenes.
62. Write a program to check if a number is an Armstrong number.
63. Write a program to find GCD and LCM of two numbers without built-in functions.
64. Write a program to convert a decimal number to binary without using bin().
65. Write a program to detect a cycle in a list.

DICTIONARIES & ADVANCED DATA HANDLING

66. Write a program to invert a dictionary (swap keys and values).


67. Write a program to find the top K frequent elements using a dictionary.
68. Write a program to merge multiple dictionaries and sum values of common keys.
69. Write a program to implement a frequency counter for large text efficiently.
70. Write a program to check if two dictionaries are equal ignoring order.

FUNCTIONS, CLOSURES & DECORATORS

71. Write a program to create a custom decorator to measure execution time of a function.
72. Write a program to demonstrate function caching (memoization).
73. Write a program using closures to create a counter function.
74. Write a program to validate function arguments using decorators.
75. Write a program to implement currying in Python.

OOP – ADVANCED & REAL-WORLD

76. Write a program to implement method overloading behavior in Python.


77. Write a program to demonstrate composition over inheritance.

© 2025|Simplifying Skills | All rights reserved


78. Write a program to create an immutable class.
79. Write a program to implement a factory design pattern.
80. Write a program to demonstrate dependency injection in Python.

FILE HANDLING & OS OPERATIONS

81. Write a program to read a large file line-by-line efficiently.


82. Write a program to search a word across multiple files in a directory.
83. Write a program to remove duplicate lines from a file.
84. Write a program to log errors into a file with timestamps.
85. Write a program to monitor file changes using Python.

ITERATORS, GENERATORS & MEMORY

86. Write a program to create a custom iterator class.


87. Write a program to generate Fibonacci numbers using a generator.
88. Write a program to demonstrate lazy loading using generators.
89. Write a program to compare memory usage of list vs generator.
90. Write a program to chain multiple generators together.

MULTITHREADING / MULTIPROCESSING / ASYNC

91. Write a program to implement multithreading for I/O-bound tasks.


92. Write a program to use multiprocessing for CPU-bound tasks.
93. Write a program to demonstrate race condition and its solution.
94. Write a program using asyncio to run tasks concurrently.
95. Write a program to implement a thread-safe counter.

ERROR HANDLING, TESTING & DEBUGGING

96. Write a program to create a custom context manager using __enter__ and __exit__.
97. Write a program to retry a failed operation using exception handling.
98. Write a program to validate input data and raise custom errors.
99. Write a program to write unit tests using unittest or pytest.
100. Write a program to gracefully handle multiple exceptions in a real-world scenario.

© 2025|Simplifying Skills | All rights reserved

You might also like