Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

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?

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the expert answer you'll need to create a free account at Brainly

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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question