Spocoman

Movie Ratings

Feb 25th, 2022 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. movie_volume = int(input())
  2. max_rating = 0
  3. min_rating = 10
  4. movie_max_rating = ""
  5. movie_min_rating = ""
  6. average_rating = 0
  7.  
  8. for i in range(movie_volume):
  9.     movie = input()
  10.     rating = float(input())
  11.     average_rating += rating
  12.     if rating > max_rating:
  13.         movie_max_rating = movie
  14.         max_rating = rating
  15.     elif rating < min_rating:
  16.         movie_min_rating = movie
  17.         min_rating = rating
  18.  
  19. print(f"{movie_max_rating} is with highest rating: {max_rating:.1f}")
  20. print(f"{movie_min_rating} is with lowest rating: {min_rating:.1f}")
  21. print(f"Average rating: {average_rating / movie_volume:.1f}")
  22.  
Add Comment
Please, Sign In to add comment