Advertisement
bl00dt3ars

06. Cake

Oct 29th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. size1 = int(input())
  2. size2 = int(input())
  3. cake_size = size1 * size2
  4. pieces = ""
  5.  
  6. while cake_size > 0:
  7.     pieces = input()
  8.     if pieces != "STOP":
  9.         pieces = int(pieces)
  10.     else:
  11.         break
  12.     cake_size -= pieces
  13. if pieces == "STOP":
  14.     print(f"{cake_size} pieces are left.")
  15. else:
  16.     print(f"No more cake left! You need {abs(cake_size)} pieces more.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement