LM Basic Data Types

Basic Data Types

In Python, data types are the fundamental building blocks that define the nature of a value. The most common basic data types include:

  • Integers (int): Whole numbers (e.g., 5, -2)
    my_age = 30
    
  • Floating-point numbers (float): Numbers with decimal points (e.g., 3.14, -0.5), useful for precise measurements.
     pi = 3.1415
    
  • Boolean (bool): True or False values, often used in condition checks.
     is_active = True
    
  • Strings (str): Sequences of characters, used to store text.
     name = "Alice"
    

Understanding these types is essential for correct variable usage and arithmetic or logical operations in your programs.

Updated: