Advertisement
HristoBaychev

FooD PET

Feb 16th, 2023
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. import math
  2.  
  3. days = int(input())
  4. total_food = float(input())
  5.  
  6. cat_food = 0
  7. dog_food = 0
  8. biscuit = 0
  9. total_eat_food = 0
  10.  
  11.  
  12. for i in range(1, days+1):
  13.     eat_for_dog_per_day = int(input())
  14.     eat_for_cat_per_day = int(input())
  15.     if i % 3 == 0:
  16.         cat_food += eat_for_cat_per_day
  17.         dog_food += eat_for_dog_per_day
  18.         biscuit += (eat_for_dog_per_day + eat_for_cat_per_day) * 0.10
  19.     else:
  20.         cat_food += eat_for_cat_per_day
  21.         dog_food += eat_for_dog_per_day
  22.  
  23.  
  24. total_eat_food = cat_food + dog_food
  25. percent_total_eat = (total_eat_food / total_food) * 100
  26. percent_total_eat_dog = (dog_food / total_eat_food) * 100
  27. percent_total_eat_cat = (cat_food / total_eat_food) * 100
  28.  
  29.  
  30. print(f'Total eaten biscuits: {biscuit:.0f}gr.')
  31. print(f'{percent_total_eat:.2f}% of the food has been eaten.')
  32. print(f'{percent_total_eat_dog:.2f}% eaten from the dog.')
  33. print(f'{percent_total_eat_cat:.2f}% eaten from the cat.')
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement