DATA TYPES

DATA TYPES

Python supports several built-in data types, including:

  1. Numeric Types:

    • int: Integer values, e.g., 5, -10, 0.
    • float: Floating-point values, e.g., 3.14, -2.5, 0.0.
    • complex: Complex numbers, e.g., 2+3j, -1-4j.
  2. Sequence Types:

    • str: Strings of characters, e.g., "hello", 'world', "42".
    • list: Ordered, mutable sequences, e.g., [1, 2, 3], ['a', 'b', 'c'].
    • tuple: Ordered, immutable sequences, e.g., (1, 2, 3), ('a', 'b', 'c').
  3. Mapping Type:

    • dict: Key-value pairs, e.g., {'name': 'John', 'age': 25}, {1: 'one', 2: 'two'}.
  4. Set Types:

    • set: Unordered collection of unique elements, e.g., {1, 2, 3}, {'a', 'b', 'c'}.
    • frozenset: Immutable version of a set, e.g., frozenset({1, 2, 3}).
  5. Boolean Type:

    • bool: Represents truth values, either True or False.
  6. None Type:

    • None: Represents the absence of a value or a null value.

These data types are used to store and manipulate different kinds of information in Python programs. They have various properties, methods, and operations associated with them, allowing you to perform different operations and transformations on data.


Comments

Popular posts from this blog

Fibonacci Series

COMPARISION EXPRESSION

LOGICAL EXPRESSION