veronikaaa86

06. Cake

Jul 30th, 2023
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. width = int(input())
  2. length = int(input())
  3.  
  4. total_count_pieces = width * length
  5.  
  6. no_more_pieces = False
  7. input_line = input()
  8. while input_line != "STOP":
  9.     current_pieces = int(input_line)
  10.  
  11.     total_count_pieces -= current_pieces
  12.  
  13.     if total_count_pieces <= 0:
  14.         no_more_pieces = True
  15.         break
  16.  
  17.     input_line = input()
  18.  
  19. if no_more_pieces:
  20.     print(f"No more cake left! You need {abs(total_count_pieces)} pieces more.")
  21. else:
  22.     print(f"{total_count_pieces} pieces are left.")
Add Comment
Please, Sign In to add comment