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