Python Data Types and Collections

In Python, data types are the building blocks of any program. They determine the kind of data that can be stored and the operations that can be performed on that data. Let's break down the common data types in Python in simple terms.

Numbers

Numbers in Python are used to store numeric values. There are three main types.

  • Integers: Whole numbers, e.g., a = 10
  • Floating Points: Numbers with decimals, e.g., a = 10.0
  • Complex Numbers: Numbers with a real and imaginary part, e.g., a = complex(10, 5), which represents 10+5j.

Strings

Strings are sequences of characters, like words or sentences. In Python, you can create a string by enclosing the text in either single quotes (') or double quotes (").