Problem:
Hello all,
I have started learning python recently. I installed python 3.2 on my Linux machine. I come to know about a function .clear() that clears the value inside a list. I am trying to clear the values of my list but it’s not working for my case, and returning an error What could be the reason behind it? Please pull me up you have the legit answer. Thanks.
Find my sample code snippet below
>>> list = [10, 20, 30, 40, 50, 60, 70]
>>> list.clear()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'clear'