Consonant Counting¶
You are required to deliver the following function in the module cons_module (file cons_module.py):
- cons_count(s, sref)¶
such that
For example:
>>> sref = 'abcdefghijklmnopqrsPQRST' >>> s = 'The very_txatxi Piruli.' >>> cons_count(s, sref) 6 >>> s = 'The very txatxi.' >>> cons_count(s, sref) 3 >>> s = 'The_txatxi.' >>> cons_count(s, sref) 2 >>> s = 'Txatxi.' >>> cons_count(s, sref) 1
Observe that the first call is 6 because s contains the consonant letters ‘T’, ‘r’, ‘h’, ‘P’, ‘r’ and ‘l’ that also are in sref.
Doctests are available in the cons_count.test file.