Teo_Yanchev

Favorite_movie_15_16_june

Jul 14th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. film_name = input()
  2.  
  3. count = 0
  4. favorite = 0
  5. favorite_name = ""
  6.  
  7. while film_name != "STOP":
  8. count += 1
  9. points_movie = 0
  10.  
  11. for char in film_name:
  12. value = ord(char)
  13. if "a" <= char <= "z":
  14. points = value - (2 * len(film_name))
  15. points_movie += points
  16. elif "A" <= char <= "Z":
  17. points = value - len(film_name)
  18. points_movie += points
  19. else:
  20. points = value
  21. points_movie += points
  22. if points_movie > favorite:
  23. favorite = points_movie
  24. favorite_name = film_name
  25.  
  26. if count >= 7:
  27. print(f"The limit is reached.")
  28. break
  29.  
  30. film_name = input()
  31. print(f"The best movie for you is {favorite_name} with {favorite} ASCII sum.")
Add Comment
Please, Sign In to add comment