python all permutations of a string
>>> from itertools import permutations
>>> perms = [''.join(p) for p in permutations('stack')]
>>> perms
python all permutations of a string
>>> from itertools import permutations
>>> perms = [''.join(p) for p in permutations('stack')]
>>> perms
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us