Problem Set 6: Word Game II I've attached the results of this assignment. I would like to point out that: 1. I didn't stick to question 100% (I developed one solution into a little game). I also optimized the code as I saw fit (not asked in problem sheet). 2. Unlike what was asked I wrote two variants of the solution. The first is covers Problems #1 - #3 while the second one addresses Problems #4 and #5. As for the code for Problem #4 I looked on-line for the combination algorithm. Hope this helps.
Here is the code.
Attached is a dry run of the function generate_all_subsets. I've used a short string "cat" to demonstrate how it builds up all the combinations.
http://docs.python.org/library/itertools.html#itertools.combinations http://docs.python.org/library/itertools.html#itertools.permutations
good work bro i been stuck on this question for te past 3 weeks, it never occured to me to make the score of the words in a separate function
dahe03: When you get stuck just ask and post your code. There are some really cool folk in MIT 6.00.
Join our real-time social learning platform and learn together with your friends!