Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- best_movie = ""
- best_ascii = 0
- counter = 0
- movie = input()
- while movie != "STOP":
- ascii_sum = 0
- for j in range(len(movie)):
- ascii_sum += ord(movie[j])
- if 96 < ord(movie[j]) < 123:
- ascii_sum -= len(movie) * 2
- elif 64 < ord(movie[j]) < 91:
- ascii_sum -= len(movie)
- if ascii_sum > best_ascii:
- best_movie = movie
- best_ascii = ascii_sum
- counter += 1
- if counter == 7:
- break
- movie = input()
- if counter == 7:
- print("The limit is reached.")
- print(f"The best movie for you is {best_movie} with {best_ascii} ASCII sum.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement