Consonant and no consonant X11047


Statement
 

pdf   zip

html

Write a function cons_nocons(f) that given a list f of nonempty strings of lowercase letters, returns two lists. The first one is formed by the words in f that contain some consonant. At the second one there are the words in f whose letters are all vowels. The order of appearance of the words in each of the two resulting lists must preserve the original order.

Important condition. Solutions employing position-wise indexed access to the argument of the function (as in f[i]) are not accepted.

Sample session
>>> cons_nocons(['ou', 'egg', 'huevo', 'iaio', 'grandpa', 'yayo'])
(['egg', 'huevo', 'grandpa', 'yayo'], ['ou', 'iaio'])
>>> cons_nocons(['egg', 'bird'])
(['egg', 'bird'], [])
>>> cons_nocons(['iaio' , 'au'])
([], ['iaio', 'au'])
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python