BbJLeB

06. Pets

May 10th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #06. Pets
  2. import math
  3. days = int(input())
  4. food_kg = int(input())
  5. dog_food = float(input())
  6. cat_food = float(input())
  7. turtle_food = float(input())
  8. dog = dog_food * days
  9. cat = cat_food * days
  10. turtle = (turtle_food * days) / 1000
  11.  
  12. all_food = dog + cat + turtle
  13.  
  14. if all_food <= food_kg:
  15.     end_food = food_kg -all_food
  16.     print(f"{math.trunc(end_food)} kilos of food left.")
  17. elif all_food > food_kg:
  18.     end_food = all_food - food_kg
  19.     print(f"{math.ceil(end_food)} more kilos of food are needed.")
Advertisement
Add Comment
Please, Sign In to add comment