Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "copyright", "credits" or "license()" for more information. >>> 23 23 >>> 2**9 512 >>> bin(512) '0b1000000000' >>> hex(512) '0x200' >>> 0b100 + 0b101 9 >>> bin(9) '0b1001' >>> s = "123" >>> int(s) 123 >>> s '123' >>> t = "10" >>> s + t '12310' >>> int(s) + int(t) 133 >>> pow(2,9) 512 >>> 2**9 512 >>> import math >>> math.trun(2.47) Traceback (most recent call last): File "", line 1, in math.trun(2.47) AttributeError: module 'math' has no attribute 'trun' >>> math.trunc(2.47) 2 >>> math.round(2.47,1) Traceback (most recent call last): File "", line 1, in math.round(2.47,1) AttributeError: module 'math' has no attribute 'round' >>> round(2.47, 1) 2.5 >>> round(2.44, 1) 2.4 >>> round(2.45, 1) 2.5 >>> math.ceil(2.47) 3 >>> x = 1 >>> y = 0 >>> x & y 0 >>> x | y 1 >>> x ^ y 1 >>> ~x -2 >>> ~0b1 -2 >>> x = 0b1101 >>> y = 0b0110 >>> x 13 >>> y 6 >>> x & y 4 >>> bin(4) '0b100' >>> a = 0b1110 >>> b = 0b0110 >>> a | b 14 >>> x = 0b11000101 >>> y = 0b00111100 >>> bin(x|y) '0b11111101' >>> x 197 >>> bin(x) '0b11000101' >>> x >> 1 98 >>> bin(x>>1) '0b1100010' >>> bin(x>>4) '0b1100' >>> x 197 >>> x//2 98 >>> x>>1 98 >>> x>>2 49 >>> x//4 49 >>> y = 31 >>> bin(y1) Traceback (most recent call last): File "", line 1, in bin(y1) NameError: name 'y1' is not defined >>> bin(y) '0b11111' >>> y<<1 62 >>> bin(62) '0b111110' >>> y<<18 8126464 >>> bin(y<<18) '0b11111000000000000000000' >>> bin(~1) '-0b10' >>> 0b11 ^ 0b01 2 >>> bin(2) '0b10' >>> 0b1 ^ 0b1 0 >>> 0b1 ^ 0b0 1 >>> a = 0 >>> a ^ 0 0 >>> a ^ 1 1 >>> b = 1 >>> b ^ 0 1 >>> b ^ 1 0 >>> x ^ 1