Univariate words X48575


Statement
 

pdf   zip

html

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 f of nonempty strings of lowercase letters, returns True when f contains an univariate word. The function returns False if f 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
>>> 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