Summary of Python 3's built-in types
Type mutable Description Syntax example
bool immutable Boolean value True
False
bytearray mutable Sequence of bytes bytearray(b'Some
ASCII')
bytearray(b"Some
ASCII")
bytearray([119, 105,
107, 105])
bytes immutable Sequence of bytes b'Some ASCII'
b"Some ASCII"
bytes([119, 105, 107,
105])
complex immutable Complex number with real and imaginary parts 3+2.7j
dict mutable Associative array (or dictionary) of key and value {'key1': 1.0, 3:
False}
pairs; can contain mixed types (keys and values),
keys must be a hashable type
ellipsis An ellipsis placeholder to be used as an index in ...
NumPy arrays
float immutable Floating point number, system-defined precision 3.1415927
frozenset immutable Unordered set, contains no duplicates; can contain frozenset([4.0,
'string', True])
mixed types, if hashable
int immutable Integer of unlimited magnitude[79] 42
list mutable List, can contain mixed types [4.0, 'string', True]
set mutable Unordered set, contains no duplicates; can contain {4.0, 'string', True}
mixed types, if hashable
str immutable A character string: sequence of Unicode codepoints 'Wikipedia'
"Wikipedia"
"""Spanning
multiple
lines"""
tuple immutable Can contain mixed types (4.0, 'string', True)