Given a string, write a Python program to find out all possible permutations of a string. Let’s discuss a few methods to solve the problem.
Method #1: Using Naive Method
Initial string abc Resultant permutations ['abc', 'acb', 'bac', 'bca', 'cba', 'cab']
Method #2: Using itertools
Initial string abc Resultant List ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Ways to split a string in different ways
- Python | Ways to check string contain all same characters
- Generate all permutation of a set in Python
- Python | Permutation of a given string using inbuilt function
- Find length of a string in python (4 ways)
- Python | Ways to find nth occurrence of substring in a string
- Count all the permutation of an array
- Ways to extract all dictionary values | Python
- Python | Multiply all numbers in the list (4 different ways)
- Reverse string in Python (5 different ways)
- Ways to remove i'th character from string in Python
- Python | Ways to remove numeric digits from given string
- Python | Ways to convert string to json object
- Python | Ways to sort letters of string alphabetically
- Python | Ways to remove n characters from start of given string
- Python | Ways to concatenate boolean to string
- Python | Ways to convert list of ASCII value to string
- Python | Ways to check if given string contains only letter
- Python | Ways to count number of substring in string
- Python - Ways to remove multiple empty spaces from string List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.