Univariate Words X97337


Statement
 

pdf   zip

thehtml

Write a boolean function is_univariate_word(s) that, given a string s, returns True if and only if s consists of repetitions of one and the same letter, ignoring case differences. For instance: word xxXxXXx is univariate, but xxXxy is not.

Sample session
>>> is_univariate_word('xxXxxxXX')
True
>>> is_univariate_word('xyyyyYYY')
False
>>> is_univariate_word('y')
True
>>> is_univariate_word('yyyyx')
False
Information
Author
ProAl
Language
English
Translator
José Luis Balcázar
Original language
Spanish
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python