MAC:Thu Feb 03:11:18:Downloads> 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. >>> 5 + 4 9 >>> 5*4 20 >>> 5 - 4 1 >>> 5/4 1.25 >>> 5//4 1 >>> 5%4 1 >>> #infix binary operator >>> 5**4 625 >>> 5^4 1 >>> 6^4 2 >>> 7^4 3 >>> 8^4 12 >>> 9^4 13 >>> # thisis a comment >>> # ordeer of ops is wormwoodean >>> type(5) <class 'int'> >>> 2**1000 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376 >>> (3 + 4)*5 35 >>> 3/5 0.6 >>> .1 + .1 + .1 == .3 False >>> .1 + .1 + .1 0.30000000000000004 >>> # dyadic rational: fraction with a denom of a power of 2 >>> 1/3 0.3333333333333333 >>> 7/8 == .875 True >>> # IEEE754 double precision floating point number >>> type(.3) <class 'float'> >>> type(True) <class 'bool'> >>> not True False >>> not False True >>> True or False True >>> False or True True >>> False or False False >>> True or True True >>> True and True True >>> True and False False >>> False and Treu False >>> False and True False >>> False and False False >>> True and True True >>> #reational operator >>> 2 + 2 == 4 True >>> 2 + 2 < 4 False >>> 2 + 2 > 4 False >>> 4 >= 5 False >>> 4 <= 5 True >>> 2 + 2 != 4 False >>> z = complex(1,2) >>> z**3 (-11-2j) >>> z.conjugate() (1-2j) >>> z (1+2j) >>> z.magnitude() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'complex' object has no attribute 'magnitude' >>> abs(z) 2.23606797749979 >>> foo = 2.23606797749979 >>> foo*foo 5.000000000000001 >>> 4 + .7 4.7 >>> 2**10000 *.3 Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: int too large to convert to float >>> 2**1000 *.3 3.214525821558802e+300 >>> "hello" 'hello' >>> 'hello' 'hello' >>> 'hello'[0] 'h' >>> 'hello'[5] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: string index out of range >>> 'hello'[1:5] 'ello' >>> 'hello'.upper() 'HELLO' >>> len('hello') 5 >>> 'hello'[:2] 'he' >>> 'hello'[2:] 'llo' >>> 'hello'[:2] + 'hello'[2:] 'hello' >>> 'hello'.find('h') 0 >>> 'hello'.find('z') -1 >>>