06. Pets
Колеги, ще помоля за малко помощ...нещо не е наред със сметките.
https://pastebin.com/8yRnBLeT
Колеги, ще помоля за малко помощ...нещо не е наред със сметките.
https://pastebin.com/8yRnBLeT
A couple of problems:
-math.ceil was required
total_food = math.ceil(food_for_dog_needed + food_for_cat_needed + food_for_turtle_needed)
-total_food had to be compared with food_in_kg
if total_food <= food_in_kg:
-final output message was not complete
f"{difference} more kilos of food are needed."
Code:
import math
days = int(input())
food_in_kg = int(input())
food_for_dog_in_kg = float(input())
food_for_cat_in_kg = float(input())
food_for_turtle_in_kg = float(input())
food_for_dog_needed = days * food_for_dog_in_kg
food_for_cat_needed = days * food_for_cat_in_kg
food_for_turtle_needed = (days * food_for_turtle_in_kg) / 1000
total_food = math.ceil(food_for_dog_needed + food_for_cat_needed + food_for_turtle_needed)
difference = abs(food_in_kg - total_food)
if total_food <= food_in_kg:
print(f"{difference} kilos of food left.")
else:
print(f"{difference} more kilos of food are needed.")
Best,
Thank you, very much! :)