We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Debugging
- Words Score
- Discussions
Words Score
Words Score
Sort by
recency
|
158 Discussions
|
Please Login in order to post a comment
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))
just update the ++score to score += 1, because python does not supports the pre and post increment concepts.
Seriously ... 30 points for spotting ++score .
Ps: