SHARE
TWEET

06. Name Wars

a guest Dec 8th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # четем имена до получаване на STOP
  2. name = input()
  3. max_sum = 0
  4. max_name = ''
  5. while name != 'STOP':
  6.     #всички символи от името -> ascii -> сума на буквите
  7.     #сумата  да я проверим дали е максимална
  8.     sum_name = 0
  9.     for letter in name:
  10.         sum_name += ord(letter)
  11.     if sum_name > max_sum:
  12.         max_sum = sum_name
  13.         max_name = name
  14.     name = input()
  15. print(f"Winner is {max_name} - {max_sum}!")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top