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.
del my_set
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


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 All rights reserved worldwide Privacy Policy Disclaimer