At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
When I read that question, I was a bit afraid too. Then I thought that this problem had probably been solved by someone else. And I was right: in Python, you can use the itertools library to solve this kind of problems:
And that's how I used it:
Thank you maitre_kaio
i just found another cool one, it is hard to parse but it looks like implements the algorithm listed in the wikipedia powerset entry
Not the answer you are looking for? Search for more explanations.
Is it the point to just find a tool that does the work you want?How deeply should you understand how each works? I cannot tell from the pset wording.Seems you could just find an example or previous tool/module to do whatever you like without really knowing the innards.I do that to some extent but feel like I am missing the basics.
i like to understand all that i can.
at least one of the 'lessons' for this pset is to show how different data types can affect execution and how pre-processing data can affect execution. Itertools.combinations and permutations were not available when this course was taught - but everyone taking the course could have easily searched the internet or the library for algorithms. Never hurts to try it yourself and learn something doing it.
Maitre_kaio, I have a similar piece to yours but why do you need .join?I am using itertools.combination on a the list,current_hand, is your 'word' a string?Seems the results from each result of itertools will be a string which can be appended to the list,letter_combinations.OK,tell me what I am doing and thinking incorrectly.
did you read the documentation for itertools.combination?