I wrote the permutations for the 4-digit number using a list and loops in python.
a =list(input("enter a four digit number:"))
n=[]
for i in range (0,4):
for j in range (0,4):
if(j!=i):
for k in range(0,4):
if(k!=i and k!=j):
for w in range (0,4):
if(w!=i and w!=j and w!=k):
n.append(a[i]+""+a[j]+""+a[k]+""+a[w])
print(n)
If the input is 1234, the output will be the permutations of all 1234 i.e., 24 permutations. Can someone help me with the permutations of the n-digit number? I would prefer to see a pythonic solution.