Advertisement
Guest User

Untitled

a guest
Jul 20th, 2020
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. count_days = int(input())
  2. total_food = float(input())
  3. sum_food_eaten_by_dog = 0
  4. sum_food_eaten_by_cat = 0
  5.  
  6. for day in range(1, count_days + 1):
  7. food_eaten_by_dog = int(input())
  8. food_eaten_by_cat = int(input())
  9. if day == 3:
  10. sum_biscuits = (food_eaten_by_dog + food_eaten_by_cat) * 0.10
  11. print(f"Total eaten biscuits: {round(sum_biscuits)}gr.")
  12. sum_food_eaten_by_dog += food_eaten_by_dog
  13. sum_food_eaten_by_cat += food_eaten_by_cat
  14.  
  15. sum_all = sum_food_eaten_by_dog + sum_food_eaten_by_cat
  16.  
  17. percentage_eaten_food = (sum_all / total_food) * 100
  18. percentage_eaten_from_dog = (sum_food_eaten_by_dog / sum_all) * 100
  19. percentage_eaten_from_cat = (sum_food_eaten_by_cat / sum_all) * 100
  20.  
  21. print(f"{percentage_eaten_food:.2f}% of the food has been eaten.")
  22. print(f"{percentage_eaten_from_dog:.2f}% eaten from the dog.")
  23. print(f"{percentage_eaten_from_cat:.2f}% eaten from the cat.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement