Function Details: clear_(set)

Description


Removes all elements from this set.


Extended Description


The clear() method removes all elements from the set, leaving it empty. This operation is in-place, meaning it modifies the original set rather than creating a new one. After calling clear(), the set will have a length of 0. This method is useful when you want to empty a set without creating a new object.


Read More about clear_(set) from Python Documentation

Function Signature


set.clear() -> None

Module: builtins

Class: set

Parameters



Return


This method doesn't return a value (None).


Return Type


None

Output

Explanation

This example shows how clear() removes all elements from a set.