import itertools print(list(itertools.permutations([1,2,3])))
Here is what the above code is Doing:
1. We are using the permutations function from the itertools module.
2. We are passing the list [1,2,3] as an argument to the permutations function.
3. The permutations function returns an object list of tuples.
4. We are converting the object list into a list using list().
5. Finally, we are printing the list.