0% found this document useful (0 votes)
2 views

Python_Programs_PracticeSet

Uploaded by

aditanpure9009
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python_Programs_PracticeSet

Uploaded by

aditanpure9009
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Write a program to reverse a given string.

2. Write a program to check if a given string is a palindrome.


3. Write a program to count the number of vowels in a given string.
4. Write a program to remove all punctuation marks from a given string.
5. Write a program to find the longest word in a given string.
6. Write a program to count the frequency of each character in a given string.
7. Write a program to convert a string to title case.
8. Write a program to find all substrings of a given string.
9. Write a program to find the largest element in a list.
10. Write a program to remove duplicates from a list.
11. Write a program to find common elements in two lists.
12. Write a program to sort a list of tuples by the second element.
13. Write a program to convert a list to a tuple.
14. Write a program to find the length of a tuple.
15. Write a program that calculates and prints the sum of all elements in a given list.
16. Create a program that finds and displays the maximum and minimum elements in a
list.
17. Implement a program that reverses a given list and prints the reversed list.
18. Write a program that sorts a list of integers in ascending order and displays the sorted
list.
19. Create a program that takes a list of numbers as input and prints only the even
numbers from the list.
20. Write a program that concatenates two lists and displays the combined list.
21. Implement a program that calculates and prints the length of a given list.
22. Create a program that checks if a specific element is present in a list and prints the
result.
23. Write a program that takes a list and prints its elements from index 2 to index 5.
24. Implement a program that removes a specified element from a list and prints the
updated list.
25. Write a program that counts the number of occurrences of a specific element in a list
and prints the count.
26. Create a program that clears all elements from a list and prints the empty list.
27. Implement a program that inserts a new element at a specified position in a list and
prints the updated list.
28. Write a program that removes all occurrences of a specified element from a list and
prints the updated list.
29. Create a program that copies all elements from one list to another and prints the
copied list.
30. Implement a program that compares two lists and prints whether they are equal or not.
31. Write a program that accesses and prints every second element of a given list.
32. Create a program that swaps the positions of two elements in a list and prints the
updated list.
33. Implement a program that joins two lists together using the extend method and prints
the combined list.
34. Write a program that removes an element from a list based on its index and prints the
updated list.
35. Write a program that creates a tuple with a few elements of your choice and prints the
tuple.
36. Create a program that accesses and prints individual elements of a tuple using
indexing.
37. Implement a program that concatenates two tuples and prints the combined tuple.
38. Write a program that unpacks a tuple into separate variables and prints each variable.
39. Create a program that calculates and prints the length of a given tuple.
40. Implement a program that checks if a specific element is present in a tuple and prints
the result.
41. Write a program that counts the number of occurrences of a specific element in a tuple
and prints the count.
42. Create a program that slices a tuple and prints a subset of its elements.
43. Implement a program that reverses a given tuple and prints the reversed tuple.
44. Write a program that sorts a tuple of integers in ascending order and prints the sorted
tuple.
45. Write a program that creates a set with a few elements of your choice and prints the
set.
46. Create a program that performs basic set operations such as union, intersection, and
difference between two sets, and prints the results.
47. Implement a program that calculates and prints the length of a given set.
48. Write a program that checks if a specific element is present in a set and prints the
result.
49. Create a program that adds an element to a set, removes an element from the set, and
prints the updated set.
50. Implement a program that clears all elements from a set and prints the empty set.
51. Write a program that updates a set with elements from another set and prints the
updated set.
52. Create a program that copies all elements from one set to another and prints the
copied set.
53. Implement a program that checks if one set is a subset or superset of another set and
prints the result.
54. Write a program that checks if two sets are disjoint (have no common elements) and
prints the result.
55. Write a program that creates a dictionary with a few key-value pairs of your choice
56. and prints the dictionary.
57. Create a program that accesses and prints the values associated with specific keys in a
dictionary.
58. Implement a program that calculates and prints the length (number of key-value pairs)
of a given dictionary.
59. Write a program that checks if a specific key is present in a dictionary and prints the
result.
60. Create a program that adds a new key-value pair to a dictionary, removes a key along
with its value from the dictionary, and prints the updated dictionary.
61. Implement a program that clears all key-value pairs from a dictionary and prints the
empty dictionary.
62. Write a program that updates a dictionary with key-value pairs from another
dictionary and prints the updated dictionary.
63. Create a program that prints all keys, values, and key-value pairs (items) from a
dictionary separately.
64. Implement a program that sorts the keys of a dictionary in ascending order and prints
the sorted keys along with their corresponding values.
65. Write a program that searches for a value in a dictionary and prints the key(s)
associated with that value.
66. Write a program to create a tuple of cubes of numbers from 1 to 10.
67. Write a program to create a dictionary from two lists, where one list contains the keys
and the other list contains the values.
68. Write a program to filter dictionary items where the value is greater than a given
number.
69. Write a program to find the union of multiple sets.
70. Write a program to remove elements from a set that are present in another set.
71. Write a program to find the cumulative sum of elements in a list.
72. Write a program to count the frequency of each character in a string.

You might also like