Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Striped Words by pokosasa
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def checkio(text):
text="".join(c.upper() if c not in " !?,." else " " for c in text)
words=[word for word in text.split() if len(word)>1 and word.isalpha()]
words=["".join("V" if c in VOWELS else "C" for c in word) for word in words]
words=[word for word in words if not("VV" in word or "CC" in word)]
return len(words)
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("My name is ...") == 3, "All words are striped"
assert checkio("Hello world") == 0, "No one"
assert checkio("A quantity of striped words.") == 1, "Only of"
assert checkio("Dog,cat,mouse,bird.Human.") == 3, "Dog, cat and human"
July 17, 2019