def square_please(some_list):
some_list[:] = [x**2 for x in some_list]
Hello, why do we need the [:] in our code in order for it to replace every item in the list with its squared value? It is not intuitive to me why we need the slicing at all.
I would think because we are assigning a new list to some_list, it would overwrite the previous list, similar to if we had the following:
list1 = [3,4,5]
list1 = [6,7,8]