Program to find permutations of a string

In this program, we will take a string as input and find permutations of a string using the function.

Steps to solve the program
  1. Take a string as input.
  2. From itertools import permutations to find the permutations of a string.
  3. Print the output.
				
					#Input string
str1 = "CDE"

from itertools import permutations
List = permutations(str1)

for combinations in list(List):
    print (''.join(combinations))
				
			

Output :

				
					CDE
CED
DCE
DEC
ECD
EDC
				
			

split and join a string using “-“

avoid spaces in string and get the total length

Leave a Comment