

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python program for the permutation of a given string inbuilt function in python
String is given. Our task is to display permutation of given string. Here solve this problem in python using inbuilt function permutations (iterable).
Example
Input : string = 'XYZ' Output : XYZ XZY YXZ YZX ZXY ZYX
Algorithm
Step 1: given string. Step 2: Get all permutations of string. Step 3: print all permutations.
Example Code
from itertools import permutations def allPermutations(str1): # Get all permutations of string 'ABC' per = permutations(str1) # print all permutations print("Permutation Of this String ::>") for i in list(per): print (''.join(i)) # Driver program if __name__ == "__main__": str1 = input("Enter the string ::>") allPermutations(str1)
Output
Enter the string ::> abc Permutation Of this String ::> abc acb bac bca cab cba
- Related Questions & Answers
- Python program for permutation of a given string inbuilt function in python
- Permutation of a given string using the inbuilt function in Python
- Python Program for BogoSort or Permutation Sort
- Inbuilt Data Structures in Python
- Python Program to print all permutations of a given string
- Program to reverse the position of each word of a given string in Python
- Python program to Count words in a given string?
- Program to find a good string from a given string in Python
- Generate all permutation of a set in Python?
- Program to find last digit of the given sequence for given n in Python
- Python program to change character of a string using given index
- Next Permutation in Python
- Python program to count the number of vowels using set in a given string
- Python program to count the number of vowels using sets in a given string
- Program to find number of elements in all permutation which are following given conditions in Python
Advertisements