Question: I have the sub class files for this program but can not figure this out, please help me with the following code. import pickle from

I have the sub class files for this program but can not figure this out, please help me with the following code.
import pickle
from inventory_item import InventoryItem
from book import Book
from game import Game
from dvd import DVD
def main():
# Calling load_inventory() should return a list of inventory items if
# inventory.dat is present. If that file is not present, it should
# return an empty list.
inventory = load_inventory()
display_inventory(inventory)
answer_outer =''
while answer_outer.lower()!='n':
answer_inner =''
while answer_inner not in ['1','2','3']:
answer_inner = input('What item type (1-Book, 2-Game, 3-DVD)?')
if answer_inner not in ['1','2','3']:
print('Enter 1,2, or 3.')
# TODO - Create an appropriate object, ask the user for item input
# using the object's method, then append the object to the inventory
# list.
answer_outer = input('Do you want to enter more items? ')
display_inventory(inventory)
save_inventory(inventory)
def load_inventory():
inventory =[]
# TODO - Attempt to load inventory data from a binary file named
# inventory.dat. If the file exists, load it into the inventory list.
# If the file does not exist, leave the inventory list empty.
return inventory
def save_inventory(inventory):
# TODO - Open a binary file named inventory.dat and dump the inventory
# list that has been passed in as a parameter to that file.
print('Inventory.dat file was created.')
def display_inventory(inventory):
print()
print('Current Inventory')
print('-----------------')
# TODO - Display the inventory items that are in the inventory list
# that was passed in as a parameter. If the list is empty, display
# "Inventory is empty."
print('-----------------')
print()
main()
I have the sub class files for this program but

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!