simeonshopov

Movie raitings

Nov 1st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. movie_count = int(input())
  2. movies = []
  3. scores = []
  4. total_score = 0
  5.  
  6. for i in range(1, movie_count + 1):
  7.     name = input()
  8.     score = float(input())
  9.     total_score += score
  10.     movies.append(name)
  11.     scores.append(score)
  12.  
  13. best_score = max(scores)
  14. best_movie = movies[scores.index(best_score)]
  15. min_score = min(scores)
  16. worst_movie = movies[scores.index(min_score)]
  17.  
  18. print(f"{best_movie} is with highest rating: {best_score:.1f}\n{worst_movie} is with lowest rating: {min_score:.1f}\n"
  19.       f"Average rating: {(total_score / movie_count):.1f} ")
Add Comment
Please, Sign In to add comment