Advertisement
webbersof

Untitled

Nov 1st, 2021
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.44 KB | None | 0 0
  1. # import sys
  2. #
  3. # film_name = input()
  4. # max_number_of_points = -sys.maxsize
  5. # number_of_movies = 0
  6. # too_much_films = False
  7. # value_of_the_digit = 0
  8. # name_of_film = ''
  9. #
  10. # while film_name != "STOP":
  11. #     total_value_of_the_film = 0
  12. #     number_of_movies += 1
  13. #     if number_of_movies > 7:
  14. #         too_much_films = True
  15. #         break
  16. #     else:
  17. #         for name_digit in film_name:
  18. #             value = ord(name_digit)
  19. #             if name_digit != name_digit.lower():
  20. #                 value_of_the_digit = value - len(film_name)
  21. #             elif name_digit == ' ':
  22. #                 value_of_the_digit = value - len(film_name)
  23. #             elif name_digit == '' f'{name_digit.lower}':  # малка буква, която след празен интервал трябва да я \
  24. #                 # направя голяма      ??
  25. #                 name_digit = name_digit.capitalize()
  26. #                 value_of_the_digit = value - len(film_name)
  27. #             elif name_digit == name_digit.lower():
  28. #                 value_of_the_digit = value - len(film_name) * 2
  29. #
  30. #             total_value_of_the_film += value_of_the_digit
  31. #             continue
  32. #         if total_value_of_the_film > max_number_of_points:
  33. #             max_number_of_points = total_value_of_the_film
  34. #             name_of_film = film_name
  35. #     film_name = input()
  36. #
  37. # if too_much_films:
  38. #     print(f'The limit is reached.')
  39. #     print(f'The best movie for you is {name_of_film} with {max_number_of_points} ASCII sum.')
  40. # else:
  41. #     print(f'The best movie for you is {name_of_film} with {max_number_of_points} ASCII sum.')
  42.  
  43. #   МОЯТ ИЗБОР ЗА КОД !!!!
  44. best_movie_points = 0
  45. movie_name = ''
  46. movie_counter = 0
  47.  
  48. while movie_counter < 7:
  49.  
  50.     name_of_movie = input()
  51.  
  52.     if name_of_movie == 'STOP':
  53.         break
  54.  
  55.     current_score = 0
  56.     for ch in name_of_movie:
  57.  
  58.         if ch == ch.lower():
  59.             if ch.isalpha():
  60.                 current_score += ord(ch) - (len(name_of_movie) * 2)
  61.             else:
  62.                 current_score += ord(ch)
  63.         else:
  64.             current_score += ord(ch) - len(name_of_movie)
  65.  
  66.     if current_score > best_movie_points:
  67.         best_movie_points = current_score
  68.         movie_name = name_of_movie
  69.  
  70.     movie_counter += 1
  71.  
  72. if movie_counter == 7:
  73.     print('The limit is reached.')
  74.  
  75. print(f'The best movie for you is {movie_name} with {best_movie_points} ASCII sum.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement