Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Striped Words by vit.aborigen
import re
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
def filter_string(text):
text = re.sub('[!@#$,.?]', ' ', text)
for word in text.upper().split():
if len(word) > 1 and all(letter.isalpha() for letter in word):
yield word
def checkio(text):
counter = 0
for word in filter_string(text):
counter += all([1 if (pair[0] in VOWELS and pair[1] in CONSONANTS) or \
(pair[0] in CONSONANTS and pair[1] in VOWELS) else 0 for pair in zip(word, word[1:])])
return counter
Nov. 10, 2018
Comments: