Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. food_in_kg = int(input())
  2. command = input()
  3.  
  4. we_have_enough_food = True
  5. food_total_in_gr = food_in_kg * 1000
  6. eaten_food_total = 0
  7.  
  8. while command != "Adopted":
  9. food_for_current_day = int(command)
  10. eaten_food_total += food_for_current_day
  11. if food_total_in_gr < eaten_food_total:
  12. we_have_enough_food = False
  13. command = input()
  14.  
  15. if we_have_enough_food:
  16. print(f"Food is enough! Leftovers: {abs(food_total_in_gr - eaten_food_total)} grams.")
  17. else:
  18. print(f"Food is not enough. You need {abs(food_total_in_gr - eaten_food_total)} grams more.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement