Advertisement
viligen

luggage_loading

Aug 21st, 2021
1,396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. capacity = float(input())
  2. total_luggage = 0
  3. counter_luggage = 0
  4. luggage_float = 0
  5. while True:
  6.     luggage_volume = input()
  7.     if luggage_volume == "End":
  8.         break
  9.     else:
  10.         luggage_float = float(luggage_volume)
  11.         total_luggage += luggage_float
  12.         counter_luggage += 1
  13.         if counter_luggage % 3 == 0:
  14.             total_luggage += 0.10 * luggage_float
  15.         if total_luggage > capacity:
  16.             counter_luggage -= 1
  17.             break
  18.  
  19.  
  20. if total_luggage <= capacity:
  21.     print(f"Congratulations! All suitcases are loaded!")
  22. else:
  23.     print("No more space!")
  24. print(f"Statistic: {counter_luggage} suitcases loaded.")
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement