8. Write a python program to remove a key value "2" from a Python dictionary, dict_a as a Python dictionary showed in the following output.
The output is:
dict_a={1:"Python", 2:"Is", 3:"Programming", 4:"Language", 5:"the", 6:"most"}
Expected Answer:
{1: 'Python', 2: 'Is', 3: 'Programming', 4: 'Language', 5: 'the', 6: 'most'}
{1: 'Python', 3: 'Programming', 4: 'Language', 5: 'the', 6: 'most'}
Sample Answer:
dict_a={1:"Python", 2:"Is", 3:"Programming", 4:"Language", 5:"the", 6:"most"} print(dict_a) if 2 in dict_a: del dict_a[2] print(dict_a)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)