Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

Word Game: Can anyone help me with writing the is_valid_word function in PS5. Here is what I have come up with http://pastebin.com/uBsRLAAd thank u!

OpenStudy (siberman):

You may be getting an error because of the lines: hand[letter] -=1 if hand[letter] == 0: return False If for example the word was door, and the hand had one 'd', it would become zero, then the function would return false. Inverting these should help. You could also check for letter in hand and hand[letter] > 0 in one if statement. Hope this Helps.

OpenStudy (anonymous):

Thank you siBerman. It works now. http://pastebin.com/HyBt5i1F

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!