50 Python Coding Questions with Answers for Freshers
Basic Python
1. Print 'Hello World'
2. Swap two numbers
3. Find largest of two numbers
4. Check even or odd
5. Find sum of two numbers
6. Check positive, negative, zero
7. Find square root of a number
8. Convert Celsius to Fahrenheit
9. Calculate simple interest
10. Print ASCII value of a character
Loops & Patterns
11. Print numbers 1 to 10
12. Sum of first N natural numbers
13. Print multiplication table
14. Factorial of a number
15. Fibonacci series
16. Prime numbers in a range
17. Reverse a number
18. Count digits in a number
19. Armstrong number
20. Palindrome number
Strings
21. Reverse a string
22. Count vowels and consonants
23. Check palindrome string
24. Remove spaces from a string
25. Count words in a sentence
26. Print frequency of characters
27. Anagram check
28. Remove duplicate characters
29. Convert string to uppercase/lowercase
30. Find longest word in a sentence
Lists & Arrays
31. Find largest element in a list
32. Find second largest element
33. Sum of elements in a list
34. Remove duplicates from a list
35. Sort a list without built-in sort
36. Merge two lists
37. Intersection of two lists
38. Reverse a list
39. Count even & odd numbers in list
40. Rotate elements in a list
Logic & Miscellaneous
41. Find GCD of two numbers
42. Find LCM of two numbers
43. Sum of digits in a number
44. Binary to decimal conversion
45. Decimal to binary conversion
46. Check leap year
47. Print prime factors of a number
48. Check perfect number
49. Print all divisors of a number
50. Check strong number (sum of factorial of digits = number)