Advertisement
bl00dt3ars

05. Suitcases Load

Nov 2nd, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. trunk_capacity = float(input())
  2. suitcase_counter = 0
  3. loaded_suitcases = 0
  4.  
  5. line = input()
  6. while line != "End":
  7.     suitcase = float(line)
  8.     suitcase_counter += 1
  9.     if suitcase_counter % 3 == 0:
  10.         trunk_capacity -= suitcase * 1.10
  11.     else:
  12.         trunk_capacity -= suitcase
  13.     if trunk_capacity < 0:
  14.         print("No more space!")
  15.         break
  16.     else:
  17.         loaded_suitcases += 1
  18.     line = input()
  19. if trunk_capacity == 0 or line == "End":
  20.     print("Congratulations! All suitcases are loaded!")
  21.  
  22. print(f"Statistic: {loaded_suitcases} suitcases loaded.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement