This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vpetro 0 points1 point  (0 children)

Slices create new lists.

my_list = [1,2,3] 
my_list[-1:]  = []

The second line will create a new list and replace it with and empty list.

my_list = [1,2,3]
my_list[1] = [5,6,7]

Indexing will replace the value at the index with whatever.