how to clear an array python

array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(array)
# Output [1, 2, 3, 4, 5, 6, 7, 8, 9]

array.clear()
print(array)
# Output []

Here is what the above code is Doing:
1. We create an array with the name array and assign it the values 1, 2, 3, 4, 5, 6, 7, 8, 9.
2. We print the array.
3. We call the clear() method on the array.
4. We print the array again.

The clear() method removes all the elements from the array.