How to generate all permutations of a list in python?



How to generate all permutations of a list in python?..

Answer / Vikas Mohan

In Python, you can generate all permutations of a list using the itertools.permutations function. For example: import itertools; print(list(itertools.permutations([1, 2, 3])))

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What is the difference between list and tuples in python?

1 Answers  


What is yaml file in python?

1 Answers  


What are python modules? Name some commonly used built-in modules in python?

1 Answers  


Can a class extend itself?

1 Answers  


Explain finally keyword?

1 Answers  


How will you get a 10 digit zero-padded number from an original number?

1 Answers  


How can you declare the variables function in python?

1 Answers  


Why is lambda used in python?

1 Answers  


Is yield a keyword in python?

1 Answers  


What are attributes in python?

1 Answers  


How do I download a file over http using python?

0 Answers  


Does Python support strongly for regular expressions? What are the other languages that support strongly for regular expressions?

1 Answers  


Categories