Advertisement
bl00dt3ars

04. Food for Pets

Nov 3rd, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. days = int(input())
  2. total_food = float(input())
  3. dog_eaten_food = 0
  4. cat_eaten_food = 0
  5. reward = 0
  6.  
  7. for i in range(1, days + 1):
  8.     dog_food = int(input())
  9.     cat_food = int(input())
  10.     if i % 3 == 0:
  11.         reward += (dog_food + cat_food) * 0.1
  12.     dog_eaten_food += dog_food
  13.     cat_eaten_food += cat_food
  14.  
  15. total_eaten_food = dog_eaten_food + cat_eaten_food
  16. print(f"Total eaten biscuits: {round(reward)}gr.")
  17. print(f"{total_eaten_food / total_food * 100:.2f}% of the food has been eaten.")
  18. print(f"{dog_eaten_food / total_eaten_food * 100:.2f}% eaten from the dog.")
  19. print(f"{cat_eaten_food / total_eaten_food * 100:.2f}% eaten from the cat.")
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement