Advertisement
Merucial

Untitled

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