DataTypes
Python DataTypes
On this page
TESTING!
Numeric types:
# int (integers)
x = 20
# float (floating point numbers)
x = 20.5
# complex (complex numbers)
x = 1j
Boolean type:
# bool (True or False)
x = True
Sequence types:
# str (strings)
x = "Hello World"
# list (mutable sequences)
x = ["apple", "banana", "cherry"]
# tuple (immutable sequences)
x = ("apple", "banana", "cherry")
# range (immutable sequences of numbers)
x = range(6)
Mapping type:
# dict (dictionaries)
x = {"name" : "John", "age" : 36}
Set types:
# set (mutable sets)
x = {"apple", "banana", "cherry"}
# frozenset (immutable sets)
x = frozenset({"apple", "banana", "cherry"})
Binary types:
# bytes (immutable sequences of bytes)
x = b"Hello"
# bytearray (mutable sequences of bytes)
x = bytearray(5)
# memoryview (memory access of other binary objects)
x = memoryview(bytes(5))
None Type
# NoneType (single value of 'None')
x = None