Advertisement
Guest User

Untitled

a guest
Aug 1st, 2020
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import math
  2. import sys
  3. word = input()
  4.  
  5. list_of_vowels = ['a','e','i','o''u','y','A','E','O','Y','I']
  6. sum = 0
  7. max_sum = -sys.maxsize
  8. powerful_word = ''
  9.  
  10. while word != "End of words":
  11. for letter in word:
  12. sum += ord(letter)
  13.  
  14. if word[0] in list_of_vowels:
  15. sum = sum * len(word)
  16. elif word[0] not in list_of_vowels:
  17. sum = math.floor(sum / len(word))
  18.  
  19. if sum > max_sum:
  20. max_sum = sum
  21. powerful_word = word
  22.  
  23. sum = 0
  24.  
  25. word = input()
  26.  
  27. if word == "End of words":
  28. print(f'The most powerful word is {powerful_word} - {max_sum}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement