Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VOWELS = 'aAeEiIoOuU'
- ascii_sum = 0
- most_ascii_sum = 0
- most_powerful_word = ''
- command = input()
- while command != 'End of words':
- word = command
- ascii_sum = 0
- for idx in range(len(word)):
- ascii_sum += ord(word[idx])
- if word[0] in VOWELS:
- ascii_sum *= len(word)
- else:
- ascii_sum //= len(word)
- if ascii_sum > most_ascii_sum:
- most_ascii_sum = ascii_sum
- most_powerful_word = word
- command = input()
- print(f'The most powerful word is {most_powerful_word} - {most_ascii_sum}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement