DiYane

*Cake* 6/10

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