Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Striped Words by gyftakiskon
import re
def checkio(text):
words = re.split('\W',text)
count = 0
for word in words:
numbers = re.search(r'[0-9]',word, re.I)
if not numbers and len(word)>1:
vowels = re.search(r'[AEIOUY]{2,}',word, re.I)
consonants = re.search(r'[BCDFGHJKLMNPQRSTVWXZ]{2,}',word, re.I)
if not vowels and not consonants:
count +=1
return count
#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"
April 8, 2015