5. Copying Method in a List

Python provides different ways to copy the contents of one list to another. These methods create a new list with the same elements, without modifying the original list.

1. copy()

The copy() method creates a shallow copy of the list. It means a new list is created with the same elements, but changes to one list won't affect the other.

Syntax:

new_list = original_list.copy()

Example:

students = ['Devanshi', 'Mukesh', 'Angel']
copied_list = students.copy()

copied_list.append('Simran')  # Modify copied list

print("Original List:", students)
print("Copied List:", copied_list)

Output:

Original List: ['Devanshi', 'Mukesh', 'Angel']
Copied List: ['Devanshi', 'Mukesh', 'Angel', 'Simran']

Explanation:

  • The copy() method creates a new list that contains the same elements as the original list.
  • When you make changes in the copied_list (like adding or removing elements), the original students list remains unchanged.
  • This proves that both students and copied_list are stored in different memory locations. So they are independent of each other.

Summary:

  • copy() method is used to create a duplicate list with the same elements.
  • It performs a shallow copy – means the new list has same values, but at a different memory location.
  • Changes made to the copied list do not affect the original list.
  • It is useful when you want to work with the same data without changing the original list.

Welcome to ShikshaSanchar!

ShikshaSanchar is a simple and helpful learning platform made for students who feel stressed by exams, assignments, or confusing topics. Here, you can study with clarity and confidence.

Here, learning is made simple. Notes are written in easy English, filled with clear theory, code examples, outputs, and real-life explanations — designed especially for students like you who want to understand, not just memorize.

Whether you’re from school, college, or someone learning out of curiosity — this site is for you. We’re here to help you in your exams, daily studies, and even to build a strong base for your future.

Each note on this platform is carefully prepared to suit all levels — beginner to advanced. You’ll find topics explained step by step, just like a good teacher would do in class. And the best part? You can study at your pace, anytime, anywhere.

Happy Learning! – Team ShikshaSanchar