Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python print combinations of string

import itertools
 
if __name__ == '__main__':
 
    nums = list("ABC")
    permutations = list(itertools.permutations(nums))
 
    # Output: ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']
    print([''.join(permutation) for permutation in permutations])
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #python #print #combinations #string
ADD COMMENT
Topic
Name
7+4 =