I'm stuck on ps5 problem #3. When running the test for is_valid_word, my function doesn't seem to be returning anything ever. letterCounts = {} valid = "True" for letter in word: letterCounts[letter] = letterCounts.get(letter, 0) + 1 for letter in letterCounts: if letterCounts[letter] > hand.get(letter, 0): valid = "False" if word not in word_list: valid = "False" return valid
For your first part, you might want to look at the get_frequency_dict function earlier in the exercise. Maybe use that on word. Also, instead of your valid variable, each for/if loop can just return True or False. Oh, and your second for loop, I would try and make it so you just compare something[letter] and hand[letter]. That kind of ties in to my first comment about using get_frequency_dict, since the hand is a frequency dict itself... Hope this helps! sorry for rambling.
I figured it out. I needed to remove the quotes from True and False.
Join our real-time social learning platform and learn together with your friends!