Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Striped Words by nov.a
import re
def checkio(line: str) -> str:
vow = 'aeiouy'
count = 0
for word in re.split('[ .,!?]', line.lower()):
if len(word) > 1 and word.isalpha():
b = ''.join(str((c in vow) * 1) for c in word)
count += ('00' not in b) and ('11' not in b)
return count
if __name__ == '__main__':
print("Example:")
print(checkio('My name is ...'))
# These "asserts" are used for self-checking and not for an auto-testing
assert checkio('My name is ...') == 3
assert checkio('Hello world') == 0
assert checkio('A quantity of striped words.') == 1
assert checkio('Dog,cat,mouse,bird.Human.') == 3
print("Coding complete? Click 'Check' to earn cool rewards!")
June 4, 2022