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 inventoryitem import InventoryItem
from book import Book
from game import Game
from dvd import DVD
def main:
# Calling loadinventory 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 loadinventory
displayinventoryinventory
answerouter
while answerouter.lowern:
answerinner
while answerinner not in :
answerinner inputWhat item type Book, Game, DVD
if answerinner not in :
printEnter or
# TODO Create an appropriate object, ask the user for item input
# using the object's method, then append the object to the inventory
# list.
answerouter inputDo you want to enter more items?
displayinventoryinventory
saveinventoryinventory
def loadinventory:
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 saveinventoryinventory:
# TODO Open a binary file named inventory.dat and dump the inventory
# list that has been passed in as a parameter to that file.
printInventorydat file was created.
def displayinventoryinventory:
print
printCurrent 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
