Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Striped Words by stalk13
import re
VOWELS = "AEIOUY"
CONSONANTS = "BCDFGHJKLMNPQRSTVWXZ"
PATTERN = r'\b[A-Z](?:(?<=[{0}])[{1}]|(?<=[{1}])[{0}])+\b'.format(VOWELS,
CONSONANTS)
def checkio(text):
matches = re.findall(PATTERN, text, re.IGNORECASE)
return len(matches)
#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"
Feb. 13, 2014
Comments: