Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- best_movie = ""
- best_movie_points = -sys.maxsize
- movies = 0
- command = input()
- while command != "STOP":
- movies += 1
- movie_points = 0
- for text in command:
- current_movie = ord(text)
- if 97 <= current_movie <= 122:
- movie_points += current_movie - (2 * len(command))
- elif 65 <= current_movie <= 90:
- movie_points += current_movie - len(command)
- else:
- movie_points += current_movie
- if movie_points > best_movie_points:
- best_movie_points = movie_points
- best_movie = command
- if movies == 7:
- print(f"The limit is reached.")
- break
- command = input()
- 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