code: def gray(num_bits):
      
      last = 0
      x = 0
      n = 1 << num_bits
      while n > x:
          bit_string = bin(n + x ^ x // 2)[3:]
          value = int(bit_string, 2)
          yield bit_string, value, changed_bit_pos(last, value)
          last = value
          x += 1
docs: Generate the Gray code for `num_bits` bits.