0
Code to print possible permutation of a string
2 odpowiedzi
+ 1
You can use 'permutations' from the 'itertools' module:
import itertools as it
initial = input('Please enter a string')
perms = it.permutations(initial)
print('\nThe permutations for {} are:\n'.format(initial))
for perm in perms:
print(''.join(perm), end = ' ')
0
Without using any tool