50 Must-Solve Python Logic Building Questions
Basics (10 Q)
• 1. Sum of two numbers (Input: 2,3 → Output: 5)
• 2. Area of circle (Input: r=5 → Output: 78.5 approx)
• 3. Convert Celsius ↔ Fahrenheit (Input: 100°C → Output: 212°F)
• 4. Even or odd check (Input: 7 → Output: Odd)
• 5. Maximum of two numbers (Input: 4,9 → Output: 9)
• 6. Simple calculator (+, -, *, /) (Input: 3+4 → Output: 7)
• 7. Swap two numbers (Input: a=2,b=5 → Output: a=5,b=2)
• 8. Check leap year (Input: 2024 → Output: Leap Year)
• 9. Check positive / negative (Input: -4 → Output: Negative)
• 10. Print first 10 natural numbers
Loops & Patterns (10 Q)
• 11. Sum of N numbers (Input: 5 → Output: 15)
• 12. Factorial of a number (Input: 5 → Output: 120)
• 13. Reverse a number (Input: 123 → Output: 321)
• 14. Table of any number (Input: 3 → Output: 3 6 9 12 15 ...)
• 15. Count digits in a number (Input: 4567 → Output: 4)
• 16. Sum of digits (Input: 123 → Output: 6)
• 17. Print Fibonacci series (Input: n=7 → Output: 0 1 1 2 3 5 8)
• 18. Print star triangle pattern
• 19. Print inverted star pattern
• 20. Armstrong number check (Input: 153 → Output: Armstrong)
Arrays / Lists (10 Q)
• 21. Find max & min element
• 22. Calculate average of list
• 23. Count even & odd numbers
• 24. Search element in list
• 25. Remove duplicates from list
• 26. Reverse list
• 27. Sort list (without sort function)
• 28. Find second largest number
• 29. Merge two lists
• 30. Count frequency of elements
Strings (10 Q)
• 31. Count vowels & consonants
• 32. Check palindrome string (Input: madam → Output: Palindrome)
• 33. Reverse string
• 34. Count words in a string
• 35. Check anagram (Input: listen,silent → Output: Yes)
• 36. Remove spaces
• 37. Change case (upper/lower)
• 38. Find longest word
• 39. Replace substring
• 40. Character frequency count
Logic / Mixed Problems (10 Q)
• 41. Find GCD & LCM
• 42. Prime number check
• 43. Generate all prime numbers in range
• 44. Decimal to binary conversion (Input: 10 → Output: 1010)
• 45. Binary to decimal conversion (Input: 1010 → Output: 10)
• 46. Sum of series 1+2+3…n
• 47. Perfect number check (Input: 28 → Output: Perfect)
• 48. Strong number check
• 49. Matrix sum (2D list)
• 50. Transpose of matrix