Advertisement
svephoto

Name Game [python]

Aug 2nd, 2020
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. import sys
  2.  
  3. name = input()
  4.  
  5. max_score = -sys.maxsize
  6. winner_name = ""
  7.  
  8. while name != "Stop":
  9.     current_score = 0
  10.  
  11.     for letter in name:
  12.         number = input()
  13.         if int(number) == ord(letter):
  14.             current_score += 10
  15.         else:
  16.             current_score += 2
  17.         if current_score >= max_score:
  18.             max_score = current_score
  19.             winner_name = name
  20.     name = input()
  21.  
  22. print(f'The winner is {winner_name} with {max_score} points!')
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement