Sobes.tech
Junior — Middle

Can you name the mutable data types used in Python?

sobes.tech AI

Answer from AI

In Python, mutable data types are those whose contents can be changed after creation. The main mutable types include:

  • list — lists
  • dict — dictionaries
  • set — sets
  • bytearray — a mutable sequence of bytes

For example, a list can be modified by adding or removing elements:

my_list = [1, 2, 3]
my_list.append(4)  # now [1, 2, 3, 4]