Method Name:
clear
Method Signature:
clear()
Overview:
The clear() method removes all the elements of a Python list object and makes the list empty.
Parameters:
None
Return Value:
None
Example:
# Example Python program that removes # A list of microprocessors # Clear the list # Print the list after clearing it # Print the length of the list |
Output:
Contents of the list: [] Length of the list: 0 |