1def permute(LIST):
2 length=len(LIST)
3 if length <= 1:
4 yield LIST
5 else:
6 for n in range(0,length):
7 for end in permute( LIST[:n] + LIST[n+1:] ):
8 yield [ LIST[n] ] + end
9
10for x in permute(["3","3","4"]):
11 print x
12