0% found this document useful (0 votes)
132 views28 pages

? 100+ Python Problems With Solutions ?

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)
132 views28 pages

? 100+ Python Problems With Solutions ?

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
You are on page 1/ 28

100+ Python Programming Problems

with Solutions: From Basics to


Advanced
Easy Python Problems (with Solutions)
1. Print "Hello, World!"

2. Swap two variables

3. Check even or odd

4. Find factorial (loop)

5. Sum of first N natural numbers

6. Reverse a string
7. Palindrome check

8. Fibonacci series (first 10 numbers)

9. Find max of three numbers

10. Check prime number

11. Find sum of digits

12. Find largest element in a list

13. Count vowels in a string


14. Multiplication table of a number

15. Check leap year

16. Convert Celsius to Fahrenheit

17. Find ASCII value of a character

18. Reverse a number

19. Simple calculator (add, sub, mul, div)


20. Count occurrences of a character in string

21. Find smallest element in a list

22. Check Armstrong number (3-digit)

23. Print all divisors of a number

24. Find length of string without len()

25. Print ASCII characters from A to Z

26. Sum of elements in a list

27. Remove duplicates from list


28. Convert decimal to binary

29. Convert binary to decimal

30. Generate random number (1–100)


Medium Python Problems (with Solutions)
31. Find GCD (Euclidean Algorithm)

32. Find LCM of two numbers

33. Binary to Decimal

34. Decimal to Binary

35. Armstrong number (any digits)

36. Count words in a string

37. Check if two strings are anagrams


38. Find second largest element in list

39. Matrix addition

40. Transpose of a matrix

41. Factorial using recursion

42. Fibonacci using recursion

43. Find prime factors of a number


44. Bubble sort

45. Insertion sort

46. Linear search

47. Binary search


48. Remove duplicates from string

49. Frequency of characters in a string

50. Reverse words in a string

51. Check pangram (contains all letters)

52. Find common elements in two lists

53. Find unique elements in list

54. Merge two sorted lists


55. Dictionary sorting by values

56. Count vowels and consonants

57. Find longest word in a string

58. Check if string is numeric

59. File read and write

60. Exception handling


61. Simple calculator using functions

62. List comprehension (squares)

63. Flatten a nested list

64. Prime numbers in a range

65. Find sum of factorials of digits

66. Check strong number (sum of factorials = number)


67. Count uppercase, lowercase, digits, special chars

68. Find HCF of multiple numbers

69. Find LCM of multiple numbers

70. Convert Roman numeral to integer


Difficult Python Problems (with Solutions)
71. Check Sudoku validity

72. N-Queens Problem (Backtracking)


73. Knapsack Problem (Dynamic Programming)

74. Longest Common Subsequence

75. Word Break Problem


76. Dijkstra’s Algorithm

77. A* Search Algorithm


78. Merge Sort

79. Quick Sort


80. Binary Tree Traversals

81. Check if Binary Tree is Balanced

82. Graph BFS


83. Topological Sort (Kahn’s Algorithm)

84. Detect Cycle in Graph (DFS)


85. Trie Implementation

86. LRU Cache


87. Regex-based Email Validator

88. Web Scraping with BeautifulSoup

89. Simple REST API with Flask

90. SQLite CRUD Example


91. Multithreading Example

92. Producer-Consumer Problem

93. Simple Chatbot using NLTK

94. Image to Grayscale with PIL


95. CSV Data Analysis with Pandas

96. Matplotlib plotting

97. Linear Regression (sklearn)

98. K-means Clustering

99. Simple Neural Network (NumPy)


100. Web Automation with Selenium
Extra 20 Python Problems (Advanced & Special Topics)
101. Generator function (yield)

102. Custom iterator

103. Decorator for logging function calls


104. Regular expressions: validate email

105. Regular expressions: extract numbers

106. Context manager (custom class)

107. Using with and contextlib


108. Dataclass example

109. Type hints & annotations

110. Lambda + map + filter

111. Reduce (functional programming)

112. JSON read & write


113. Random password generator

114. Virtual environment info (sys module)

115. Unit testing (unittest)

116. Command-line arguments (sys.argv)

117. Zip and enumerate


118. Namedtuple

119. Counter (word frequency)

120. Heapq (priority queue)

You might also like