Function Details: clear_(list)

Description


Removes all items from the list.


Extended Description


The clear() method removes all items from the list, leaving it empty. This operation is in-place, meaning it modifies the original list rather than creating a new one. After calling clear(), the list will have a length of 0. This method is equivalent to del a[:] but it's more obvious and readable.


Read More about clear_(list) from Python Documentation

Function Signature


list.clear() -> None

Module: builtins

Class: list

Parameters



Return


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


Return Type


None

Output

Explanation

This example shows how clear() removes all items from a list.