How to write my permutation generation function? Help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write my permutation generation function? Help!

How to write my permutation generation function with python? Help me please..

15th Feb 2021, 6:37 PM
Emily
Emily - avatar
2 Answers
+ 3
There is already a function `permutations()` in the 'itertools' module in Python. Why not use that? https://docs.python.org/3/library/itertools.html#itertools.permutations If you want to implement it yourself, you can maybe use Heap's algorithm https://en.m.wikipedia.org/wiki/Heap%27s_algorithm
15th Feb 2021, 8:32 PM
XXX
XXX - avatar
+ 2
Idk what those words mean off the top of my head. But include the math in the problem and link your attempted code in the description as well.
15th Feb 2021, 8:09 PM
Slick
Slick - avatar