Advertisement
bl00dt3ars

06. Gold Mine

Nov 15th, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. num_location = int(input())
  2.  
  3. average_gold_for_day = 0
  4. total_gold = 0
  5.  
  6. for location in range(1,num_location + 1):
  7.     average_gold_about_day = float(input())
  8.     num_days_in_that_location = int(input())
  9.     average_gold_for_day = 0
  10.  
  11.     for day in range(1,num_days_in_that_location + 1):
  12.         gold_for_day = float(input())
  13.         average_gold_for_day += gold_for_day
  14.  
  15.     total_gold = average_gold_for_day / day
  16.  
  17.     if total_gold >= average_gold_about_day:
  18.         print(f"Good job! Average gold per day: {total_gold:.2f}.")
  19.     else:
  20.         print(f"You need {abs(average_gold_about_day - total_gold):.2f} gold.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement