Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- width = int(input())
- length = int(input())
- #броя парчета =
- pieces = width * length
- # стоп: pieces <= 0
- #продължават да си взимат: pieces > 0
- while pieces > 0:
- #команда -> STOP или брой парчета
- command = input()
- if command == 'STOP':
- print(f'{pieces} pieces are left.')
- break
- else:
- #брой парчета под формата на стринг
- taken_pieces = int(command)
- pieces -= taken_pieces
- else: #ако тортата свърши -> pieces <= 0
- print(f'No more cake left! You need {abs(pieces)} pieces more.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement