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.
def score_words(words):
score = 0
score1 =0
for word in words:
num_vowels = 0
for letter in word:
if is_vowel(letter):
num_vowels =num_vowels + 1
if num_vowels % 2 == 0:
score=score + 2
else:
score1=score1 + 1
return score+score1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Words Score
You are viewing a single comment's thread. Return to all comments →
def score_words(words): score = 0 score1 =0 for word in words: num_vowels = 0 for letter in word: if is_vowel(letter): num_vowels =num_vowels + 1 if num_vowels % 2 == 0: score=score + 2 else: score1=score1 + 1 return score+score1