Home >>Python Set Methods >Python Set clear() Method
Python set clear() method is used to remove all the elements in the given input set.
Syntax:set.clear()Here is an example of Python clear() method:
thisset = {"apple", "banana", "cherry"}
thisset.clear()
print(thisset)
newset = {"php","python","java"}
thisset.clear()
print(thisset)