1. lucky_nums = []
  2. for L in range(1,11):
  3. for mask in range(0,2**L):
  4. s = bin(mask)[2:].zfill(L)
  5. s = s.replace('0','4').replace('1','7')
  6. lucky_nums.append(int(s))
  7. print(lucky_nums)
Comments powered by Disqus