Advertisement
Guest User

Untitled

a guest
Nov 1st, 2019
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. movie_counter = 0
  2. winner_movie = 0
  3. winner_name = ''
  4. total_points = 0
  5. while True:
  6.     movie = input()
  7.  
  8.     if movie == 'STOP':
  9.         print(f"The best movie for you is {winner_name} with {winner_movie} ASCII sum.")
  10.         break
  11.  
  12.     movie_counter += 1
  13.  
  14.     if movie_counter == 7:
  15.         print(f"The limit is reached.")
  16.         print(f"The best movie for you is {winner_name} with {winner_movie} ASCII sum.")
  17.         break
  18.  
  19.     movie_points = 0
  20.     points = 0
  21.  
  22.     for char in movie:
  23.        ascii_value = ord(char)
  24.  
  25.        if 'a' <= char <= 'z':
  26.            points = ascii_value - (2 * len(movie))
  27.            movie_points += points
  28.        elif 'A' <= char <= 'Z':
  29.            points = ascii_value - len(movie)
  30.            movie_points += points
  31.        else:
  32.            points = ascii_value
  33.            movie_points += ascii_value
  34.  
  35.  
  36.     if movie_points > winner_movie:
  37.         winner_movie = movie_points
  38.         winner_name = movie
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement