Advertisement
aneliabogeva

Name Wars

May 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import string
  2. import sys
  3.  
  4. name = input()
  5. max_sum = -sys.maxsize-1
  6. current_sum = 0
  7. winner = ""
  8.  
  9. while name != "STOP":
  10. for letter in name:
  11. current_sum += ord(letter)
  12. if current_sum > max_sum:
  13. max_sum = current_sum
  14. winner = name
  15. name = input()
  16. current_sum = 0
  17. print(f"Winner is {winner} - {max_sum}!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement