bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Foundations
Python•Foundations

Python - Copy Lists

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Python - Copy Lists?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Order

Put the learning moves in the order that makes the concept easiest to apply.

Use the slice Operator
Use the list() method
Use the copy() method

Copy a List

You cannot copy a list simply by typing list2 = list1 , because: list2 will only be a reference to list1 , and changes made in list1 will automatically also be made in list2 .

Use the copy() method

You can use the built-in List method copy() to copy a list.

copy()

Use the list() method

Another way to make a copy is to use the built-in method list() .

list()

Use the slice Operator

You can also make a copy of a list by using the : (slice) operator.

:

Previous

Python - Sort Lists

Next

Python - Join Lists