Univariate words X48575


Statement
 

pdf   zip

A word is said to be univariate when all its letters are the same. For instance ’xxx’ is an univariate word. Write a function @has_univariate_word(f)@ that given a list ff of nonempty strings of lowercase letters, returns True when ff contains an univariate word. The function returns False if ff has no univariate words.

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

Sample session

Sample session
>>> has_univariate_word(['xxyxx', 'aaaab', 'ba', 'open', 'close'])
False
>>> has_univariate_word(['car', 'd'])
True
>>> has_univariate_word(['xxx' , 'window'])
True
>>> has_univariate_word([])
False
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python