asked 22.3k views
4 votes
To copy a list you can use this. list2 = list1[ : ]

True or False

asked
User MackM
by
7.5k points

1 Answer

0 votes

Answer:

True.

Step-by-step explanation:

The colon in square brackets is used to subsetting the list.

for example list1=[1,2,4,6,2,5]

print(list1[3:5])

This will print 6 ,2

Because it means the list from index 3 to 4 the last value is not inclusive.So if you write [:] it means the whole list and in the question we are assigning it to list2.So all the values from list1 will be copied to list2.

answered
User Jason Sankey
by
8.1k points