# int types # int arithmetic operators. a = 20 b = 3 print(f"a: {a}") print(f"b: {b}") print(f"a+b: {a+b}") print(f"a-b: {a-b}") print(f"a*b: {a*b}") print(f"a/b: {a/b}") print(f"a//b: {a//b}") print(f"a%b: {a%b}") print(f"a**b: {a**b}") c = a/b print(f"type(a): {type(a)}") print(f"type(b): {type(b)}") print(f"type(c): {type(c)}") # int assignments. x = 4 print(f"x: {x}") x += 2 print(f"after x+= 2; x: {x}") x -= 3 print(f"after x-= 3; x: {x}") x *= 6 print(f"after x*= 6; x: {x}") x %= 4 print(f"after x%=4; x: {x}") # Comparisons operators p = 5 q = 7 print(f"p > q: {p > q}") print(f"p >= q: {p >= q}") print(f"p == q: {p == q}") print(f"p < q: {p < q}") print(f"p <= q: {p <= q}") # bitwise operation. s = 5 # binary: 0101 t = 3 # binary: 0011 print(f"s: {s}; binary: {s:08b}") print(f"t: {t}; binary: {t:08b}") print(f"s & t: {s & t}; binary: {s&t:08b}") # bitwise and print(f"s | t: {s | t}; binary: {s|t:08b}") # bitwise or print(f"s ^ t: {s ^ t}; binary: {s^t:08b}") # bitwise exclusive or print(f"s<<1: {s<<2}; binary: {s<<2:08b}") # shift left 1 bits.