Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

shawnf Group Title

Problem 3: scrabble The function for checking whether a word is valid passes the test provided: if word in word_list: for k in range(0,len(word)-1): if (word[k] in hand.keys()) & (word.count(word[k]) <= hand.get(word[k])): return True else: return False The main code seems to not implement correctly: if not is_valid_word(word, hand, wordlist): word = raw_input("Enter word, or a '.' to indicate that you are finished: ") if word == '.': print "Your total score is: " + str(score) any ideas?

  • one year ago
  • one year ago

  • This Question is Closed
  1. shawnf Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    added the following under for loop if word[k] not in hand.keys(): return False That seems to fix it, but the function passes the test without it, so I think the test should include situations where the word contains letters that are not in the hand.

    • one year ago
    • Attachments:

See more questions >>>

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.