0% found this document useful (0 votes)
12 views4 pages

Python Ps

The document lists a series of programming challenges categorized into four sections: String, List-Based, Dictionary, and Function-Based. Each section contains various tasks such as reversing words, finding duplicates, and checking for palindromes. Additionally, advanced questions are provided for further exploration in each category.

Uploaded by

Varsha Lipsee
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)
12 views4 pages

Python Ps

The document lists a series of programming challenges categorized into four sections: String, List-Based, Dictionary, and Function-Based. Each section contains various tasks such as reversing words, finding duplicates, and checking for palindromes. Additionally, advanced questions are provided for further exploration in each category.

Uploaded by

Varsha Lipsee
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

String

1. Reverse each word in a string without changing word order

2. Find the first non-repeating character in a string

3. Check if two strings are anagrams

4. Count frequency of each character in a string

5. Find the longest substring without repeating characters

6. Remove duplicate characters from a string

7. Find all substrings of a string

8. Check if a string is a palindrome (ignore spaces & case)

9. Replace all vowels with * in a string

10. Find the most frequent word in a sentence

List-Based

11. Find second largest element in a list

12. Remove duplicates from a list without using set()

13. Find all pairs in a list whose sum equals a target

14. Rotate a list by k positions

15. Flatten a nested list (1 level deep)

16. Find common elements in two lists

17. Sort a list without using sort() or sorted()

18. Find missing number in a list from 1 to n

19. Move all zeros to end of list

20. Find longest consecutive sequence in a list

Dictionary

21. Count frequency of elements in a list using dictionary

22. Merge two dictionaries (add values if keys are same)

23. Find key with maximum value in dictionary

24. Invert a dictionary (swap keys and values)

25. Group words by their length

26. Count occurrences of each word in a sentence


27. Create a dictionary from two lists

28. Sort dictionary by values

29. Find duplicate values in dictionary

30. Convert list of tuples into dictionary

function-Based

31. Write a function to check prime number

32. Recursive function to find factorial

33. Function to generate Fibonacci series up to n

34. Function to check Armstrong number

35. Function to count vowels and consonants

36. Function to find LCM of two numbers

37. Function to check perfect number

38. Function to return all divisors of a number

39. Function to check if number is palindrome

40. Function to find GCD of two numbers

List Comprehension

41. Create list of squares from 1 to 20

42. Get even numbers from a list

43. Convert list of strings to uppercase

44. Create list of tuples (number, square)

45. Flatten nested list

46. Remove empty strings from list

47. Get words longer than 5 characters

48. Replace negative numbers with 0

49. Create dictionary using list comprehension

50. Extract digits from a string into a list


Advanced Questions (

String (51–60)

51. Find the longest word in a sentence

52. Count number of vowels in a string

53. Check if string contains only digits

54. Capitalize first letter of each word

55. Find duplicate characters in a string

56. Remove all spaces from a string

57. Find second most frequent character

58. Check if one string is rotation of another

59. Convert string to title case (without built-in)

60. Find common characters between two strings

list (61–70)

61. Find max and min without built-in functions

62. Reverse a list without reverse()

63. Find elements at even indexes

64. Split list into two halves

65. Find duplicates in a list

66. Remove all occurrences of an element

67. Find product of all elements

68. Find intersection of multiple lists

69. Check if list is palindrome

70. Find difference between two lists

Dictionary (71–75)

71. Count number of keys in dictionary

72. Remove a key safely

73. Check if key exists

74. Sum all values

75. Create nested dictionary


Functions

76. Function to check even or odd

77. Function to reverse a number

78. Function to find sum of digits

79. Function to swap two numbers

80. Function to check leap year

You might also like