Advertisement
DiYane

Guinea Pig

Sep 18th, 2023
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. quantity_food_in_kilograms = float(input())
  2. quantity_hay_in_kilograms = float(input())
  3. quantity_cover_in_kilograms = float(input())
  4. weight_in_kilograms = float(input())
  5.  
  6. quantity_food_in_grams = quantity_food_in_kilograms * 1000
  7. quantity_hay_in_grams = quantity_hay_in_kilograms * 1000
  8. quantity_cover_in_grams = quantity_cover_in_kilograms * 1000
  9. weight_in_grams = weight_in_kilograms * 1000
  10. is_food_not_left = False
  11. month_days = 30
  12.  
  13. for day in range(1, month_days+1):
  14.     quantity_food_in_grams -= 300
  15.     if quantity_food_in_grams <= 0:
  16.         is_food_not_left = True
  17.    
  18.     if day % 2 == 0:
  19.         quantity_hay_in_grams -= quantity_food_in_grams * (5/100)
  20.         if quantity_hay_in_grams <= 0:
  21.             is_food_not_left = True
  22.    
  23.     if day % 3 == 0:
  24.         quantity_cover_in_grams -= weight_in_grams * 1/3
  25.         if quantity_cover_in_grams <= 0:
  26.             is_food_not_left = True
  27.    
  28.     if is_food_not_left:
  29.         print('Merry must go to the pet store!')
  30.         break
  31.        
  32. if not is_food_not_left:        
  33.     print('Everything is fine! Puppy is happy! ' \
  34.           f'Food: {quantity_food_in_grams/1000:.2f}, ' \
  35.           f'Hay: {quantity_hay_in_grams/1000:.2f}, ' \
  36.       f'Cover: {quantity_cover_in_grams/1000:.2f}.')
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement