• Slider Banner

    The Programming World

    Learn about top programming languages, tools and frameworks.

    Read more
  • Slider Banner

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read more
  • Slider Banner

    Prepare for Technical Interview

    Over 1 Million+ interview questions for different technical profiles.

    Read more

Differentiate between deep and shallow copy in Python.

A deep copy copies an object into another. This means that if you make a change to a copy of an object, it won’t affect the original object. In Python, we use the function deepcopy() for this, and we import the module copy. We use it like:

import copy
y = copy.deepcopy(x)

A shallow copy, however, copies one object’s reference to another. So, if we make a change in the copy, it will affect the original object. For this, we have the function copy(). We use it like:

import copy
y = copy.copy(x)


What are the applications of Python?

Python is used in various software domains some application areas are given below.

  • Web and Internet Development
  • Games
  • Scientific and computational applications
  • Language development
  • Image processing and graphic design applications
  • Enterprise and business applications development
  • Operating systems
  • GUI based desktop applications

What Native Data Structures Can You Name in Python? Of These, Which Are Mutable, and Which Are Immutable?

Common native data structures in Python are as follows:

  • Dictionaries (Mutable)
  • Lists (Mutable)
  • Sets (Mutable)
  • Strings (Immutable)
  • Tuples (Immutable)

Strings and tuples are immutable, as their contents can't be altered once they're created.

Subscribe to