Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1.  
  2. days = int(input())
  3. all_food = float(input())
  4. biscuits = 0
  5. food_dog = 0
  6. food_cat = 0
  7. eaten_food =0
  8. precent_dog = 0
  9. precent_cat = 0
  10. precent_eaten = 0
  11. for day in range (1, days + 1):
  12.     eatfood_dog = int(input())
  13.     eatfood_cat = int(input())
  14.     food_dog += eatfood_dog
  15.     food_cat += eatfood_cat
  16.  
  17.     if day % 3 == 0:
  18.         biscuits = (eatfood_dog + eatfood_cat) * 0.1
  19.  
  20. eaten_food = food_dog + food_cat
  21. precent_eaten = eaten_food / all_food * 100
  22. precent_dog = food_dog / eaten_food * 100
  23. precent_cat = food_cat / eaten_food * 100
  24.  
  25. print(f"Total eaten biscuits: {round(biscuits)}gr.")
  26. print(f"{precent_eaten:.2f}% of the food has been eaten.")
  27. print(f"{precent_dog:.2f}% eaten from the dog.")
  28. print(f"{precent_cat:.2f}% eaten from the cat.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement