I'm on pset5, problem #4. I can't get play_hand to work, here is the code: http://codepad.org/xzMNLi3x. Unfortunately, I can't show an output because word_list needs to be loaded, so I just copied the play_hand definition, I can copy the entire code if necessary though. In the meantime, I can offer a sample output: Loading word list from file... 83667 words loaded. play_game not implemented. User hand: {'x': 1, 'r': 2, 'j': 1, 'e': 2, 'd': 1} Please enter a word: red False Please enter a word
So as you can see, is_valid_word() doesn't ever determine the word to be false BUT if I run the test code, and run my own test it always passes. Here is the is_valid_word code: http://codepad.org/S2JoSpjZ You can see "rap" returns true, because it's in the hand and dictionary. Whereas, rapture does not because the hand only contains one "r" (and rapture contains two). I have also tested this with word_list and it works as well. Help is greatly appreciated!
well that's embarrassing. Thanks for taking the time, i'm pretty sure that's the problem. Cheers
:)
Join our real-time social learning platform and learn together with your friends!