from itertools import* z=0 while z<1e4:x=[y for y in permutations(str(z))if'0'