Advertisement
aneliabogeva

Cake

May 13th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. weight = int(input())
  2. lenght = int(input())
  3. command = input()
  4. totalPieces = 0
  5. cakeSize = weight * lenght
  6. sumOfPieces = 0
  7. while command != "STOP":
  8. sumOfPieces = int(command)
  9. totalPieces += sumOfPieces
  10. if totalPieces > cakeSize:
  11. print(f"No more cake left! You need {totalPieces - cakeSize} pieces more.")
  12. break
  13. command = input()
  14. if command == "STOP":
  15. print(f"{cakeSize-totalPieces} pieces are left.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement