Python Problem Sheet - I | Python
VANITA VISHRAM WOMEN’S UNIVERSITY, SURAT
Three Year Bachelor of Computer Application Course
YEAR 2025 – 2026
[Link] (SEMESTER-IV)
Subject: - CAM208-2C Python Programming
Problem Sheet
String
1. Write a program to check whether two strings are anagrams.
2. Write a program to find duplicate characters in a string.
3. Write a program to reverse each word in a given sentence.
4. Write a program to find the longest word in a string.
5. Write a program to remove punctuation from a string.
List
6. Create a list and perform following operation on list :-
1. Access elements of list.
2. Sort list
3. Update elements of list
4. Delete elements of list
5. Pop elements of list
6. Find Length/Number of element of list
7. Maximum element within a list
8. Concatenate list
9. Iterating through a list
10. Reverse the list
7. Write a python script to sum all the items in a list.
8. Write a python script to swap first and last elements of the list.
Input : [11, 24, 9, 50, 20]
Output : [20, 24, 9, 50, 11]
9. Write a python script to print duplicate items from the list of
Integers. Input : list = [10, 20, 30, 20, 20, 30, 40, 30]
Output : output_list = [20, 30]
10. Write a python script to count positive and negative number in a list.
Input: list1 = [2, -7, 5, -64, -14]
Output: pos = 2, neg = 3
11. Write a python script to take 10 integer inputs from user and store them in a list.
Now, copy all the elements in another list but in reverse order.
12. Write a python program to create a list by taking 10 input from user. and delete
all repeated elements of the list.
Python Problem Sheet - I | Python
13. Write a python script to find common elements from two lists.
Input :-
l1=[11,12,3,4,5,6]
l2=[11,12,13,14,15,6]
output :-
11,12
14. Write python program to print Histogram using list.
Output :-
****
*********
*******
15. Write python program to Split List into Even and Odd Lists.
Input:
lst = [1, 2, 3, 4, 5, 6]
Output:
even = [2,4,6]
odd = [1,3,5]
Tuple
16. Create a tuple and perform following operations on tuple: -
1. Find size of tuple.
2. Access tuple elements.
3. Update elements of tuple.
4. Unpacking a tuple
5. Join two tuples
17. Write python program to create a list of tuples from given list having number
and its cube in each tuple.
Input: list = [1, 2, 3]
Output: [(1, 1), (2, 8), (3, 27)]
18. Write a python script to sum all the items in a tuple using function.
19. Write a python script to sort Tuple of Tuples by Second Element.
Input:
t = ((1, 3), (4, 1), (2, 2))
Output:
((4, 1), (2, 2), (1, 3))
20. Write a python script to count occurrence of given item in the tuple.
Input: tuple=(2,3,4,2,5,2)
Output: count of 2 is 3
21. Write a python script to search for the first occurrence of given item 9 and
return its position.
Input: tuple=(3,8,9,10,5,2)
Output: Index of 8 is 2
Dictionary
22. Write a Python script to concatenate the following dictionaries to create a new
one.
Python Problem Sheet - I | Python
23. Create a dictionary and perform following operations on dictionary:-
1. Add elements to a dictionary.
2. Change Value of dictionary.
3. Accessing elements from dictionary.
4. Remove specific elements from dictionary
5. Find length of dictionary
6. Print all keys of dictionary.
7. Print all values of dictionary.
8. Remove all elements from dictionary.
9. Create copy of dictionary.
24. Write a Python script to check whether a given key already exists in a
dictionary.
25. Write a Python script to print a dictionary where the keys are numbers between
1 and 15 (both included) and the values are the square of the keys.
26. Write a Python program to sum all the items in a dictionary
27. Write a Python program to remove a key from a dictionary
28. Write a Python program to check if a dictionary is empty or not
29. Write a Python program to combine two dictionary by adding values for
common keys.
30. Write a Python program to print all distinct values in a list of dictionary.
31. Write a Python program to find the length of a dictionary of values.
Original Dictionary:
{1: 'red', 2: 'green', 3: 'black', 4: 'white', 5: 'black'}
Length of dictionary values:
{'red': 3, 'green': 5, 'black': 5, 'white': 5}
32. Write a Python program to count the frequency of a dictionary.
Original Dictionary:
{'V': 10, 'VI': 10, 'VII': 40, 'VIII': 20, 'IX': 70, 'X': 80, 'XI': 40, 'XII': 20}
Count the frequency of the said dictionary:
Counter({10: 2, 40: 2, 20: 2, 70: 1, 80: 1})
Set
33. Create a set and perform following operations on set :-
1. Access elements of set.
2. Add elements to set.
3. Find length of set.
4. Remove any elements from set.
5. Remove specific elements from a set if it is present in the set.
6. Remove all elements of the set.
34. Write a Python program to create an intersection of sets
35. Write a Python program to create a union of sets.
36. Write a Python program to create set difference
37. Write a Python program to find the maximum and minimum values in a set.
38. Write a Python program to check if a given value is present in a set or not.
39. Write a Python program to check if two given sets have no elements in
common.
40. Write a Python program to find elements in a given set that are not in another
set.