Sichanov

gg

Aug 10th, 2021
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. trunk_volume = float(input())
  2.  
  3. total_volume = trunk_volume
  4. counter = 0
  5. added = 0
  6. while True:
  7.     current_volume = input()
  8.  
  9.     if current_volume == 'End':
  10.         print(f'Congratulations! All suitcases are loaded!')
  11.         break
  12.  
  13.     current_bag_volume = float(current_volume)
  14.     counter += 1
  15.     if counter % 3 == 0:
  16.         current_bag_volume = current_bag_volume + (current_bag_volume * 0.1)
  17.  
  18.     if total_volume - current_bag_volume >= 0:
  19.         total_volume -= current_bag_volume
  20.         added += 1
  21.     else:
  22.         print(f'No more space!')
  23.         break
  24.  
  25. print(f'Statistic: {added} suitcases loaded.')
  26.  
Advertisement
Add Comment
Please, Sign In to add comment