Count word endings X58695


Statement
 

pdf   zip

html

Write a function count_word_endings(x) that receives a tuple x of words, and returns how many of them end in ‘s’, how many end in ‘d’, and how many end in ‘t’.

Sample session
>>> count_word_endings( ('dog', 'cat', 'birds', 'reached', 'eat') )
(1, 1, 2)
>>> count_word_endings( ('dog', 'had', 'cat', 'reached') )
(0, 2, 1)
>>> count_word_endings( ('dog', 'fog', 'why', 'not') )
(0, 0, 1)
>>> sum( count_word_endings( ('dog', 'had', 'cat', 'reached') ) )
3
Information
Author
Language
English
Official solutions
Python
User solutions
Python