Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

LoveMathFermat

  • 2 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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Where is your source code?

  2. LoveMathFermat
    • 2 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
    • 2 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
    • 2 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.

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.