Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

LoveMathFermat

  • 3 years ago

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?

  • This Question is Closed
  1. Fonzy
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Where is your source code?

  2. LoveMathFermat
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  3. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    http://docs.python.org/2.7/library/exceptions.html#exceptions.KeyError

  4. rsmith6559
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy