5. Write a python program to remove item from set_a which provided in the following output.
The output is:
set_a = set(['Python', 'Free', 'Exercises', 'Tutorials', 'Sets', 'Library'])
Expected Answer:
After removing first item: {'Python', 'Sets', 'Library', 'Exercises', 'Tutorials'}
After removing second item: {'Sets', 'Library', 'Exercises', 'Tutorials'}
Sample Answer(Remove one item) :
set_a = set(['Python', 'Free', 'Exercises', 'Tutorials', 'Sets', 'Library']) set_a.pop() print("After removing first item: ", set_a)
Sample Answer(Remove two items) :
set_a = set(['Python', 'Free', 'Exercises', 'Tutorials', 'Sets', 'Library']) set_a.pop() print("After removing first item: ", set_a) set_a.pop() print("After removing second item: ",set_a)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)