logo CodeStepByStep logo

four_letter_words

Write a function called four_letter_words accepts a string representing a file name as a parameter and returns a count of the number of words in the file that are exactly four letters long. Words are separated by whitespace. Do not worry about punctuation; look for any four-character token.

Use Python's functional programming constructs, such as list comprehensions, map, filter, reduce, to implement your function. Do not use any loops or recursion in your solution.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.