Generating bitmask

n = len(nums)
nth_bit = 1 << n
for i in range(2**n):
    bitmask = bin(i | nth_bit)[3:]
    print(bitmask)

n = len(nums)
for i in range(2**n, 2**(n+1)):
    bitmask = bin(i)[3:]
    print(bitmask)