Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Striped Words by asad
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
import re
def checkio(text):
data = re.sub(r'[,\.?!:;]', ' ', text.lower()).split()
data = [word for word in data if len(word) > 1 and word.isalpha()]
data = [''.join(["v" if x in 'aeiouy' else "c" for x in word]) for word in data]
return sum([0 if 'cc' in x or 'vv' in x else 1 for x in data])
#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"
Jan. 8, 2015
Comments: