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

Hi! everyone! I'm working on #3 of problem set 5 which is a word game. I keep getting this error for some reason. I don't understand what this tells me. if is_valid_word(word, hand, word_list): File "/Users/piljoomoon/Documents/ps5.py", line 181, in is_valid_word if hand[letters] == 0 or hand[letters] < 0: KeyError: 'h' ##hand is a dictionary (string-->int) Is there anyone who completed this homework and can help me?

OpenStudy (anonymous):

Where is your source code?

OpenStudy (anonymous):

HI Fonzy, This is my code: http://dpaste.com/842327/

OpenStudy (rsmith6559):

Just for troubleshooting, print letters and hand[ letters ] just before the if statement in line 181. I'll bet you'll be surprised.

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!