Advertisement
BbJLeB

Хъъхх

Jun 15th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. movie = input()
  2.  
  3. sum_max = -1000000
  4. best = None
  5. movie_count = 0
  6.  
  7. while not movie == "STOP":
  8.     movie_count += 1
  9.     if movie_count == 7:
  10.         print("The limit is reached.")
  11.         break;
  12.     sum_ascii = 0
  13.     for letter in movie:
  14.         sum_ascii += ord(letter)
  15.         if 97 <= ord(letter) <= 122:
  16.             sum_ascii -= 2 * len(movie)
  17.         elif 65 <= ord(letter) <= 90:
  18.             sum_ascii -= len(movie)
  19.  
  20.     if sum_ascii > sum_max:
  21.         sum_max = sum_ascii
  22.         best = movie
  23.     movie = input()
  24.  
  25. print(f"The best movie for you is {best} with {sum_max:.0f} ASCII sum.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement