In this example we will show how to make a copy of a list with the list() method in Python.
Source Code
my_list = ['a', 'b', 'c', 'd', 'e']
my_list_2 = list(my_list)
print(my_list_2)
Output:
['a', 'b', 'c', 'd', 'e']
In this example we will show how to make a copy of a list with the list() method in Python.
my_list = ['a', 'b', 'c', 'd', 'e']
my_list_2 = list(my_list)
print(my_list_2)
Output:
['a', 'b', 'c', 'd', 'e']
In this example we will show how to make a copy of a list with the copy() method in Python.
my_list = ['a', 'b', 'c', 'd', 'e']
my_list_2 = my_list.copy()
print(my_list_2)
Output:
['a', 'b', 'c', 'd', 'e']