Data Types

Built-in Python data types include integer (int), floating point (float), string (str), and Boolean (bool) data types.

value = 1 + 1
print(value)          # Displays 2
print(type(value))    # Displays <type 'int'>

value = 0.1 + 0.1
print(value)          # Displays 0.2 
print(type(value))    # Displays <type 'float'>

value = '1' + '1'
print(value)          # Displays 11
print(type(value))    # Displays <type 'str'>

value = True
print(value)          # Displays True
print(type(value))    # Displays <type 'bool'>

results matching ""

    No results matching ""