https://github.com/Jayraj1729/PIP-Practical2-20CS023.git
Questions
Dictionary
a. Write a Python script to check whether a given key already exists in a dictionary.
b. Write a Python script to merge two Python dictionaries.
c. Write a Python program to sum all the items in a dictionary.
d. Write a Python script to add a key to a dictionary.
Sample Dictionary : {0: 10, 1: 20}
Expected Result : {0: 10, 1: 20, 2: 30}
e. Write a Python script to concatenate following dictionaries to create a new one.
Sample Dictionary :
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50,6:60}
Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
Tuple
a. Write a Python program to create a tuple with different data types.
b. Write a Python program to create a tuple with numbers and print one item.
c. Write a Python program to add an item in a tuple.
d. Write a Python program to convert a tuple to a string.
e. Write a Python program to find the length of a tuple.
Set
a. Write a Python program to add member(s) in a set and clear a set
b. Write a Python program to remove an item from a set if it is present in the set.
c. Write a Python program to create an intersection, Union, difference of sets.
d. Write a Python program to find maximum and the minimum value in a set.
e. Write a Python program to find the most common elements and their counts from list, tuple, dictionar