HackerRank Python - Words Score




In this challenge, the task is to debug the existing code to successfully execute all provided test files.



  1. def is_vowel(letter):
  2. return letter in ['a', 'e', 'i', 'o', 'u', 'y']
  3. def score_words(words):
  4. score = 0
  5. for word in words:
  6. num_vowels = 0
  7. for letter in word:
  8. if is_vowel(letter):
  9. num_vowels += 1
  10. if num_vowels % 2 == 0:
  11. score += 2
  12. else:
  13. score += 1
  14. return score
  15. n = int(input())
  16. words = input().split()
  17. print(score_words(words))
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]


donate a cup of tea :)


Join Our Facebook Group

Share this solution






codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube