Data Type

A data type is a classification of data that defines what kind of value a variable can hold in a programming language. It determines how the data is stored in memory and what operations can be performed on it.

Common Data Types:

  1. Integer (int) – Whole numbers (e.g., 10, -3, 1000)
  2. Float (float) – Decimal numbers (e.g., 3.14, -0.5, 2.71)
  3. String (str) – Text or sequences of characters (e.g., "hello", 'Python')
  4. Boolean (bool) – True/False values (True, False)
  5. List (list) – Ordered collection of elements (e.g., [1, 2, 3], ["apple", "banana"])
  6. Tuple (tuple) – Immutable ordered collection (e.g., (1, 2, 3))
  7. Dictionary (dict) – Key-value pairs (e.g., {"name": "Alice", "age": 25})
  8. Set (set) – Unordered collection of unique elements (e.g., {1, 2, 3})