posted by ama .
Problem 3: Baggage
Name your source code file Bags.py.
You will write a program that simulates the actions of luggage handling for a large aircraft.
As bags arrive they are loaded into containers. Each bag has a different weight and each container can hold a maximum amount of weight. When a container has reached its maximum weight capacity, or the next bag in the line will cause it to exceed its weight capacity, or there is no more bags, the container is sent to be loaded into the aircraft.
At the aircraft loading station, containers are unloaded such that the last container which arrives will be the first to be unloaded. The bags in each container are unloaded in the same order as they were loaded, i.e., last on, last off.
Write a program that prompts the user for a filename and the maximum container weight. The file will contain a list of bag weights in the order that the bags arrive. Your program should output to the screen the weights of the bags in the order they are unloaded. Two sample data files, bags25.dat and bags100.dat, are provided for you to test your program.
For example, here are the contents of the file bags25.dat:
16 24 25 3 20 18 7 17 4 15 13 22 2 12 10 5 8 1 11 21 19 6 23 9 14
If you really want the help of an expert in this subject, you'll follow directions and put the SUBJECT in the School Subject box.