veronikaaa86

06. Cake

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