Words Score

  • + 0 comments

    import sys

    def score_words(words): vowels = {'a','e','i','o','u','y'} score = 0 for word in words: vowels_count = sum(1 for i in word if i in vowels) if vowels_count%2==0: score = score+2 else: score = score+1 return score

    if name == "main": n = int(input()) word = input().split() words = [] for i in range(n): if len(word[i])<=20 and word[i].islower(): words.append(word[i]) print(score_words(words))