Advertisement
go6odn28

While_more_exercises_1_Dishwasher

Oct 3rd, 2023
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. # 1. Dishwasher
  2.  
  3. bottles_detergent = int(input())
  4.  
  5. total_detergent = bottles_detergent * 750
  6. pots_num = 0
  7. dishes_num = 0
  8. load_counter = 1
  9.  
  10. while total_detergent > 0:
  11.     command = input()
  12.     if command == 'End':
  13.         break
  14.     curr_loading = int(command)
  15.     if (load_counter % 3) == 0:
  16.         pots_num += curr_loading
  17.         total_detergent -= curr_loading * 15
  18.     elif (load_counter % 3) != 0:
  19.         dishes_num += curr_loading
  20.         total_detergent -= curr_loading * 5
  21.     load_counter += 1
  22.  
  23. if total_detergent >= 0:
  24.     print("Detergent was enough!")
  25.     print(f"{dishes_num} dishes and {pots_num} pots were washed.")
  26.     print(f"Leftover detergent {total_detergent} ml.")
  27. else:
  28.     print(f"Not enough detergent, {abs(total_detergent)} ml. more necessary!")
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement