Advertisement
veronikaaa86

04. Food for Pets

Feb 19th, 2022
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. days = int(input())
  2. available_food = float(input())
  3.  
  4. #days == 3
  5. biscuit_total = 0
  6. total_food = 0
  7. dog_total_food = 0
  8. cat_total_food = 0
  9. for i in range(1, days + 1):
  10. dog_food = int(input())
  11. cat_food = int(input())
  12. daily_food = dog_food + cat_food
  13.  
  14. if i % 3 == 0:
  15. biscuit_total = biscuit_total + (0.10 * daily_food)
  16.  
  17. total_food = total_food + daily_food
  18.  
  19. dog_total_food = dog_total_food + dog_food
  20. cat_total_food = cat_total_food + cat_food
  21.  
  22.  
  23. percent_total = total_food / available_food * 100
  24. percent_dog = dog_total_food / total_food * 100
  25. percent_cat = cat_total_food / total_food * 100
  26.  
  27. print(f"Total eaten biscuits: {round(biscuit_total)}gr.")
  28. print(f"{percent_total:.2f}% of the food has been eaten.")
  29. print(f"{percent_dog:.2f}% eaten from the dog.")
  30. print(f"{percent_cat:.2f}% eaten from the cat.")
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement