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']
- Find length of a string in python (4 ways)
- Python | Ways to find nth occurrence of substring in a string
- Python | Ways to split a string in different ways
- Python | Permutation of a given string using inbuilt function
- Reverse string in Python (5 different ways)
- Python | Ways to check if given string contains only letter
- Python | Ways to concatenate boolean to string
- Python | Ways to check string contain all same characters
- Ways to remove i'th character from string in Python
- Python | Ways to remove n characters from start of given string
- Python | Ways to sort letters of string alphabetically
- Python | Ways to convert list of ASCII value to string
- Python | Ways to remove numeric digits from given string
- Python | Ways to convert string to json object
- Python | Ways to count number of substring in string
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.