Sobes.tech
Junior — Middle

Can you list the main data types used in Python?

sobes.tech AI

Answer from AI

In Python, the main data types include:

  • int — integers, for example, 42
  • float — floating-point numbers, for example, 3.14
  • str — strings, for example, "hello"
  • bool — boolean values: True or False
  • list — a mutable ordered list of elements, for example, [1, 2, 3]
  • tuple — an immutable ordered set, for example, (1, 2, 3)
  • dict — a dictionary that stores key-value pairs, for example, {"key": "value"}
  • set — a collection of unique elements, for example, {1, 2, 3}
  • NoneType — a special type for the value None, indicating the absence of a value

These types cover most programming tasks and allow efficient data handling.