Python Copying a list
Copying a list
To copy a list make a slice that starts at the first item and ends at the last item. If you try to copy a list without using this approach, whatever you do to the copied list will affect the original list as well.
To copy a list make a slice that starts at the first item and ends at the last item. If you try to copy a list without using this approach, whatever you do to the copied list will affect the original list as well.
#Making a copy of a list finishers =['kai', 'abe', 'ada', 'gus', 'zoe'] copy_of_finishers = finishers[:] print(copy_of_finishers)
No comments:
Post a Comment