Sobes.tech
Middle

What data types are there in Python? Mutable and immutable?

sobes.tech AI

Answer from AI

Python has several basic data types, which are divided into mutable and immutable.

Immutable types:

  • int (integers)
  • float (floating-point numbers)
  • bool (boolean values)
  • str (strings)
  • tuple (tuples)
  • frozenset (immutable set)

Mutable types:

  • list (lists)
  • dict (dictionaries)
  • set (sets)
  • bytearray (mutable byte arrays)

For example, strings and tuples cannot be changed after creation, while lists and dictionaries can be modified by adding, removing, or changing elements.

What data types are there in Python? Mutable and… - sobes.tech