Advertisement
pacho_the_python

Programming Basics Online Exam - 28 and 29 March 2020

Oct 16th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. cargo_place = float(input())
  2.  
  3. suitcases = 0
  4. space_left = False
  5. command = input()
  6. while command != "End":
  7.     current_suitcase = float(command)
  8.     if cargo_place < current_suitcase:
  9.         space_left = True
  10.         break
  11.     suitcases += 1
  12.     if suitcases % 3 == 0:
  13.         current_suitcase = current_suitcase + current_suitcase * 0.1
  14.     cargo_place -= current_suitcase
  15.     command = input()
  16.  
  17. if space_left:
  18.     print("No more space!")
  19. else:
  20.     print("Congratulations! All suitcases are loaded!")
  21. print(f"Statistic: {suitcases} suitcases loaded.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement