https://docs.python.org/3/library/functions.html
bin(3)
'0b11'
help(format)
Help on built-in function format in module builtins: format(value, format_spec='', /) Return value.__format__(format_spec) format_spec defaults to the empty string. See the Format Specification Mini-Language section of help('FORMATTING') for details.
# If prefix "0b is desired or not, use either of the following ways
print(format(3, '#b'))
print(format(3, 'b'))
0b11 11
print(chr(65))
print(chr(97))
print(chr(8364))
A a €
globals()
{'__name__': '__main__', '__doc__': 'Automatically created module for IPython interactive environment', '__package__': None, '__loader__': None, '__spec__': None, '__builtin__': <module 'builtins' (built-in)>, '__builtins__': <module 'builtins' (built-in)>, '_ih': ['', 'bin(3)', '# If prefix "0b is desired or not, use either of the following ways\nprint(format(3, \'#b\'))\nprint(format(3, \'b\'))', 'print(chr(65))\nprint(chr(97))\nprint(chr(8364))', 'globals()'], '_oh': {1: '0b11'}, '_dh': ['/Volumes/Storage/GoogleDrive/CMU/Python/thinkpythonnotebooks'], '_sh': <module 'IPython.core.shadowns' from '/Users/rbasnet/miniconda3/lib/python3.7/site-packages/IPython/core/shadowns.py'>, 'In': ['', 'bin(3)', '# If prefix "0b is desired or not, use either of the following ways\nprint(format(3, \'#b\'))\nprint(format(3, \'b\'))', 'print(chr(65))\nprint(chr(97))\nprint(chr(8364))', 'globals()'], 'Out': {1: '0b11'}, 'get_ipython': <bound method InteractiveShell.get_ipython of <ipykernel.zmqshell.ZMQInteractiveShell object at 0x10f035278>>, 'exit': <IPython.core.autocall.ZMQExitAutocall at 0x10fa42668>, 'quit': <IPython.core.autocall.ZMQExitAutocall at 0x10fa42668>, '_': '0b11', '__': '', '___': '', '_i': 'print(chr(65))\nprint(chr(97))\nprint(chr(8364))', '_ii': '# If prefix "0b is desired or not, use either of the following ways\nprint(format(3, \'#b\'))\nprint(format(3, \'b\'))', '_iii': 'bin(3)', '_i1': 'bin(3)', '_1': '0b11', '_i2': '# If prefix "0b is desired or not, use either of the following ways\nprint(format(3, \'#b\'))\nprint(format(3, \'b\'))', '_i3': 'print(chr(65))\nprint(chr(97))\nprint(chr(8364))', '_i4': 'globals()'}
print(hex(42))
print(hex(-42))
0x2a -0x2a
# Other ways
print(format(255, '#x'))
print(format(255, 'x'))
print(format(255, 'X'))
0xff ff FF
print(oct(100))
0o144
print(format(10, '#o'))
print(format(10, 'o'))
0o12 12
print(ord(' '))
print(ord('~'))
32 126
x = 10
id(x)
4525196800
print(divmod(7, 3)) # return (quotient, remainder)
quotient, remainder = divmod(7, 3)
print(quotient, remainder)
(2, 1) 2 1
y = 2
print(eval('y**2'))
print(eval('y+2*3'))
4 8
print('max=', max(100, 8.9, 999, 1000.5))
max= 1000.5
print('min=', min(100, 8.9, 999, 1000.5))
min= 8.9
print('2 to the power 3 =', pow(2, 3))
2 to the power 3 = 8
print('hi', 'hello', sep='', end='')
hihello
print('hi', 'hello', sep=' ', end='')
hi hello
print('hi', 'hello', sep=' ', end='')
print('next line?')
hi hellonext line?
print('hi', 'hello', sep='\t', end='\n')
print('next line?')
hi hello next line?