How to Empty Set Using Clear() Method in Python


In this example we will show how to empty the set using the clear() method in Python.

Source Code

my_set = {'a', 'b', 1, 'c'}

my_set.clear()

print(my_set)

Output:

set()
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments