Advertisement
bl00dt3ars

06. Favorite Movie

Nov 13th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import sys
  2. best_movie = ""
  3. best_movie_points = -sys.maxsize
  4. movies = 0
  5. command = input()
  6.  
  7. while command != "STOP":
  8.     movies += 1
  9.     movie_points = 0
  10.     for text in command:
  11.         current_movie = ord(text)
  12.         if 97 <= current_movie <= 122:
  13.             movie_points += current_movie - (2 * len(command))
  14.         elif 65 <= current_movie <= 90:
  15.             movie_points += current_movie - len(command)
  16.         else:
  17.             movie_points += current_movie
  18.  
  19.     if movie_points > best_movie_points:
  20.         best_movie_points = movie_points
  21.         best_movie = command
  22.  
  23.     if movies == 7:
  24.         print(f"The limit is reached.")
  25.         break
  26.     command = input()
  27.  
  28. print(f"The best movie for you is {best_movie} with {best_movie_points} ASCII sum.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement