>>> x = 0 >>> y = 1 >>> x, y = y, x >>> x 1 >>> y 0 >>> x = ["a", "bb", "ccc"] >>> x ['a', 'bb', 'ccc'] >>> a, b, c = x >>> a 'a' >>> b 'bb' >>> c 'ccc' >>> a, b = x Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack (expected 2) >>> help(len) >>> help(ord) >>> print(ord.__doc__) Return the Unicode code point for a one-character string. >>> print(chr.__doc__) Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. >>> 0x10ffff 1114111 >>> import math >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'a', 'b', 'c', 'math', 'x', 'y'] >>> dir(math) ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp'] >>> math.cos(0) 1.0 >>> math.cos(90) -0.4480736161291702 >>> math.radians(1) 0.017453292519943295 >>> math.degrees(1) 57.29577951308232 >>> math.cos(Math.pi) Traceback (most recent call last): File "", line 1, in NameError: name 'Math' is not defined. Did you mean: 'math'? >>> math.cos(math.pi) -1.0 >>> math.log(10) 2.302585092994046 >>> math.log(100)/math.log(10) 2.0 >>> math.log(100, 10) 2.0 >>> math.log(1000, 2) 9.965784284662087 >>> math.pow(2,10) 1024.0 >>> math.factorial(30) 265252859812191058636308480000000 >>> math.factorial(1000) 402387260 (zillions of digits ...) 0000000000000000000 >>> help(math.factorial) >>> dir(math) ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp'] >>> print(exp.__doc__) Traceback (most recent call last): File "", line 1, in NameError: name 'exp' is not defined >>> print(math.exp.__doc__) Return e raised to the power of x. >>> math.sqrt(2) 1.4142135623730951 >>> math.lcm(3,22) 66 >>> math.lcm(3,255) 255 >>> math.gcd(9238059238452389509823408902340892345, 382990832983024982349324089802349824398234293485) 15 >>> math.floor(4.5) 4 >>> math.floor(-4.5) -5 >>> math.ceil(2.000000001) 3 >>> math.round(4.5) Traceback (most recent call last): File "", line 1, in AttributeError: module 'math' has no attribute 'round' >>> dir(math) ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp'] >>> ^D MAC:Thu Feb 17:10:55:~> !p python Python 3.10.0 (v3.10.0:b494f5935c, Oct 4 2021, 14:59:19) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__'] >>> from math import * >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc', 'ulp'] >>> ##intimate import, you are on a first-name basis >>> cos(0) 1.0 >>> pi = 4 >>> cos(pi) -0.6536436208636119 >>> ^D MAC:Thu Feb 17:10:57:~> python Python 3.10.0 (v3.10.0:b494f5935c, Oct 4 2021, 14:59:19) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from math import cos >>> cos(0) 1.0 >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'cos'] >>> from math import log, sin >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'cos', 'log', 'sin'] >>> ##selective import >>> >>>