- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to generate all permutations of a list in Python?
You can use the itertools package's permutations method to find all permutations of a list in Python. You can use it as follows −
import itertools perms = list(itertools.permutations([1, 2, 3])) print(perms)
This will give the output −
[(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]
- Python - Generate all possible permutations of words in a Sentence
- Program to count average of all special values for all permutations of a list of items in Python
- How to find all possible permutations of a given string in Python?
- Python Program to print all permutations of a given string
- How to generate a sorted list in Python?
- All possible permutations of N lists in Python
- Python program to get all permutations of size r of a string
- Generate all permutation of a set in Python?
- Print all permutations of a given string
- All permutations of a string using iteration?
- Print all permutations of a string in Java
- How to create permutations as a list in R?
- C++ Program to Generate All Possible Combinations of a Given List of Numbers
- Print all palindrome permutations of a string in C++
- Python Program to Print All Permutations of a String in Lexicographic Order without Recursion