Sichanov

computer_firm

May 22nd, 2021
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. number_of_pc_models = int(input())
  2. total_sales = 0
  3. total_rating = 0
  4. for each_pc_model in range(number_of_pc_models):
  5.     number = int(input())
  6.     rating = number % 10
  7.     sales = number // 10
  8.     if rating == 2:
  9.         sales = 0
  10.     elif rating == 3:
  11.         sales /= 2
  12.     elif rating == 4:
  13.         sales *= 0.7
  14.     elif rating == 5:
  15.         sales *= 0.85
  16.     total_sales += sales
  17.     total_rating += rating
  18. average_rating = total_rating / number_of_pc_models
  19. print(f'{total_sales:.2f}')
  20. print(f'{average_rating:.2f}')
  21.  
Advertisement
Add Comment
Please, Sign In to add comment