id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs112fall2015 > firstLetterCount
prev  |  next  |  chance

Write a function firstLetterCount(words) that takes as a parameter a list of strings named words and computes a dictionary D with lower case letters as keys and the number of words in words that begin with that letter as values. Finish your code with the line return [D], i.e. return a list containing D as its only item.


firstLetterCount(['ant', 'bee', 'armadillo', 'dog', 'cat']) → [{'a': 2, 'b': 1, 'c': 1, 'd': 1}]
firstLetterCount(['All', 'are', 'actually', 'Awesome', 'aye?']) → [{'a': 5}]
firstLetterCount(['no', 'Repeated', 'Words', 'Are', 'here']) → [{'a': 1, 'r': 1, 'w': 1, 'h': 1, 'n': 1}]

...Save, Compile, Run (ctrl-enter)

def firstLetterCount(words):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy