Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

permutation of a string in python

# Function to find permutations of a given string
from itertools import permutations
  
def allPermutations(str):
       
     # Get all permutations of string 'ABC'
     permList = permutations(str)
  
     # print all permutations
     for perm in list(permList):
         print (''.join(perm))
        
# Driver program
if __name__ == "__main__":
    str = 'ABC'
    allPermutations(str)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #permutation #string #python
ADD COMMENT
Topic
Name
8+7 =