desislava_topuzakova

6. Cake

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