anonymous
  • anonymous
In the given dictionary, each key is a single lowercase letter and each value is a list of lowercase words that start with that letter. Based on the given dictionary, return a new dictionary in which each key is a single lowercase letter and each value is the number of lowercase words that start with that letter.''' is this right if i am writing like this ? def get_letter_counts(old_dict): new_dict = {} for letters in old_dict: for words in letters: word_num = len(words)+1 new_dict[letters] = word_num return new_dict
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
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.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Close. But you didn't need any sort of inner loop. "for letters in old_dict" should actually be "for letter(singular) in old_dict" because during each iteration you are only dealing with a single letter. Once you have this single letter all you need to do is take the length of old_dict[letter] and store it to new_dict[letter]. Try this: def get_letter_counts(old_dict): new_dict = {} for letter in old_dict: new_dict[letter] = len(old_dict[letter]) return new_dict

Looking for something else?

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