7. Встроенные функции.

Рассмотрим некоторые встроенные функции.

# all
print all([False, True, True])
print all([False, False, False])
print all([True, True, True])
False
False
True
# any
print any([True, False, False])
print any([True, True, True])
print any([False, False, False])
True
True
False
# callable
print callable(any)
print callable(lambda elem: -elem)
print callable(1)
print callable("")
True
True
False
False
# chr, ord
print chr(48)
print ord('0')
0
48
# enumerate
for ind, letter in enumerate(['a', 'b', 'c']):
    print ind, letter
0 a
1 b
2 c
# bin, hex, oct
print bin(20)
print hex(20)
print oct(20)
0b10100
0x14
024
# id - for CPython this is the address in memory
a = lambda elem: -elem
print id(a)
140434626765000
# isinstance
print isinstance("abc", str)
print isinstance("abc", int)
True
False
# locals
# print locals()

# globals
# print globals()