Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

permutation python

def permutations(s):
    if len(s) <= 1: 
        yield s
    else:
        for i in range(len(s)):
            for p in permutations(s[:i] + s[i+1:]):
                yield s[i] + p
        
input = 'ABCD'

for permutation in enumerate(permutations(input)):
    print repr(permutation[1]),
print
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #permutation #python
ADD COMMENT
Topic
Name
9+1 =