Primitive Data Types
Every piece of data in Python has a ‘type’ or data type. This is important so that Python knows how to process the data. Basic (primitive) data types are the foundation of all more complex data.
Key Concept
- Integer (int): Whole numbers (no decimals). Examples: 10, -50, 2025.
- Float (float): Decimal numbers (using a decimal point). Examples: 3.14, 99.9, 0.5.
- String (str): A collection of characters or text (enclosed in ‘ or “). Examples: ’Hello Purwokerto”, ‘Python”.
- Boolean (bool): A logical truth value. There are only two: True or False.