Menu Close

Print all Possible Combinations from three Digits.

Python Program to Accept Three Digits and Print all Possible Combinations from the Digits.

A=list(map(str,input("Enter the Combinations: ").split()))
alnum=A[0]+A[1]+A[2]

for i in range(3):
  for j in range(3):
    for k in range(3):
      if(i!=j and j!=k and k!=i):
        print(alnum[i],alnum[j],alnum[k])

INPUT_1:
           1 5 2
OUTPUT:
           1 5 2
           1 2 5
           5 1 2
           5 2 1
           2 1 5
           2 5 1


INPUT_2:
          1 5 9
OUTPUT:
         1 5 9
         1 9 5
         5 1 9
         5 9 1
         9 1 5
         9 5 1


More Codes to Fcuk


Explore