Python Data Types

Overview of Data Types

Built-in types include int, float, str, bool, list, tuple, set, and dict.

Type Checking

Use type() and isinstance() to inspect types.

Examples

# int
x = 5
# float
y = 3.14
# str
s = "Hello"
# list
lst = [1, 2, 3]
# dict
d = {"key": "value"}