Advertisement
Merucial

Untitled

Mar 28th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. days = int(input())
  2. food = float(input())
  3. dog_food_eaten = float(input())
  4. cat_food_eaten = float(input())
  5. counter = 0
  6.  
  7. for d in range(days):
  8.     dog_food_eaten = float(input())
  9.     cat_food_eaten = float(input())
  10.     counter += 1
  11.     if counter == days:
  12.         break
  13.  
  14.     if days == 3:
  15.         dog_food_eaten = dog_food_eaten * 0.01
  16.         cat_food_eaten = cat_food_eaten * 0.01
  17.     total_food_eaten = cat_food_eaten + dog_food_eaten
  18.     total_food = (total_food_eaten * 100) / food
  19.     total_food_dog_eaten = (dog_food_eaten * 100) / total_food_eaten
  20.     total_cat_food_eaten = (cat_food_eaten * 100) / total_food_eaten
  21. # print(f'Total eaten biscuits: {}gr.')
  22. print(f'{total_food:.2f}% of the food has been eaten.')
  23. print(f'{total_food_dog_eaten:.2f}% eaten from the dog.')
  24. print(f'{total_cat_food_eaten:.2f}% eaten from the cat.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement