Hi, I'm on problem set 5 problem 6: implementing the game 'ghost'. I have two questions. 1) The 'Helper Code' includes a function to convert the string to a dictionary, is it easier to work with dictionaires in this problem and why? 2) A rule in the game is that players must create word fragments that can become words, how do I search the wordlist to check this?

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.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

Hi, I'm on problem set 5 problem 6: implementing the game 'ghost'. I have two questions. 1) The 'Helper Code' includes a function to convert the string to a dictionary, is it easier to work with dictionaires in this problem and why? 2) A rule in the game is that players must create word fragments that can become words, how do I search the wordlist to check this?

MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

MIT OCW 2008?? my solution does not use the frequency dictionary function the startswith() string method may be usefull. I used a bisection search of the wordlist to see if a fragment could make a word http://docs.python.org/2.7/library/stdtypes.html#str.startswith
I used the str.startswith and it worked. I haven't done a bisection of the wordlist because I found that an answer was return straight away with "any (w.startswith(frag) for w in wordlist)". although I imagine a bisect seach would be more efficient
yeh OCW 2008

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

keep it simple, if it works and its not to slow it's ok. nice generator.
1) Dictionaries are a mapping between a key and a value. Your variables are actually a dictionary: foo = 3 foo is the key, 3 is the value. When you want foo's value, you just refer to foo. Most of the rest of it is just syntax stuff. One thing that isn't much fun with dictionaries, if you refer to a key that doesn't exist, they raise an exception. The good news, is that dictionaries have method to query them that won't raise an exception: foo = dict.get( key, sentinalValue ) if( foo == sentinalValue ): print "shucks!" else: print "you got key's value"
http://pyvideo.org/video/1738/good-enough-is-good-enough

Not the answer you are looking for?

Search for more explanations.

Ask your own question