Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 11 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!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
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!