clear() method for set
All set methods
clear() takes no argument.
Returns : No return value.
Output is here
del and clear() difference
We can use keyword del to remove any object. Once it is removed then further use of it raise NameError.
Here we will removed the set object by using del, so the last line will generate the error ( NameError)
All set methods Questions with solutions on set discard()
Subscribe to our Youtube Channel here
This article is written by plus2net.com team.