simeonshopov

Favorite movie (june exam)

Nov 7th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. movie = input()
  2. scores, movies, counter = [], [], 0
  3.  
  4. while movie != "STOP":
  5.     score = 0
  6.     counter += 1
  7.     for i in movie:
  8.       i = ord(i)
  9.       score += i
  10.       if i in range(97, 123):
  11.         score -= 2 * len(movie)
  12.       elif i in range(65, 91):
  13.         score -= len(movie)
  14.     scores.append(score)
  15.     movies.append(movie)
  16.     if counter == 7:
  17.       winner = max(scores)
  18.       winner_name = movies[scores.index(winner)]
  19.       print(f"The limit is reached.")
  20.       print(f"The best movie for you is {winner_name} with {winner} ASCII sum.")
  21.       break
  22.     movie = input()
  23. else:
  24.   winner = max(scores)
  25.   winner_name = movies[scores.index(winner)]
  26.   print(f"The best movie for you is {winner_name} with {winner} ASCII sum.")
Add Comment
Please, Sign In to add comment