Middle
Standard data types in Python.
sobes.tech AI
Answer from AI
In Python, there are several standard data types that can be divided into several categories:
- Numbers:
int(integers),float(floating-point numbers),complex(complex numbers). - Boolean type:
bool(valuesTrueandFalse). - Sequences:
str(strings),list(lists),tuple(tuples). - Sets:
set(set),frozenset(immutable set). - Dictionaries:
dict(key-value mapping). - NoneType:
None— a special type to denote the absence of a value.
Example usage:
x = 10 # int
pi = 3.14 # float
name = "Alice" # str
is_active = True # bool
items = [1, 2, 3] # list
config = {'host': 'localhost', 'port': 5432} # dict