Advertisement
ALEXANDAR_GEORGIEV

Dishwasher

Jun 7th, 2022 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. a_bottle = 750  # 750 ml  # 2 Зареждания с чинии и 1 зареждане с тенджери
  2. check_plates = 2
  3. count_plates = 0
  4. count_pots = 0
  5. count_bottles = int(input())
  6. open_detergent = count_bottles * a_bottle
  7. left_detergent = open_detergent
  8. while True:
  9.     count_units = input()
  10.     if count_units == 'End':
  11.         break
  12.     count_units = int(count_units)
  13.     if check_plates > 0:
  14.         count_plates = count_plates + count_units
  15.         check_plates -= 1
  16.         left_detergent = left_detergent - (5 * count_units)
  17.         if left_detergent < 0:
  18.             break
  19.     else:
  20.         count_pots = count_pots + count_units
  21.         left_detergent = left_detergent - (15 * count_units)
  22.         check_plates = 2
  23.         if left_detergent < 0:
  24.             break
  25. balance = abs(left_detergent)
  26. if left_detergent >= 0:
  27.     print('Detergent was enough!')
  28.     print(f'{count_plates} dishes and {count_pots} pots were washed.')
  29.     print(f'Leftover detergent {left_detergent} ml.')
  30. else:
  31.     print(f'Not enough detergent, {balance} ml. more necessary!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement