Question: M 6 Lab Instructions Introduction: Assignment evaluate student understanding of concepts learned in this module in addition to concepts learned in previous modules. Instructions: In
MLab Instructions
Introduction:
Assignment evaluate student understanding of concepts learned in this module in addition to concepts learned in previous modules.
Instructions:
In this assignment, we will be building on MPro, remember MPro was a store inventor
The program should continue to work the same only in this assignment we also want to write the information into files.
def categoryinventory:
Parameters
inventory : nested dictionary for store inventory
function searches for category entered and displays items under category found
category inputEnter categoryfirst letter of each word MUST be capitalized:
if category in inventory: # found
for cat, v in inventory.items:
if cat category:
printf
Item:Quantity:Unit Price"
for sub content in vitems:
printfsub:contentQuantity:$contentUnit Price"
else:
# not found
printf
The category entered was NOT found!
def getiteminventory:
Parameters
inventory : nested dictionary for store inventory
function searches for item entered and displays item information
item inputEnter Itemfirst letter MUST be capitalized:
# search in nested dict
iteminfo # placeholder for cat dictionary
for cat, v in inventory.items:
if item in v: # get nested dict
for sub, content in vitems:
if item sub:
iteminfo content
if iteminfo : # item not found so no item category dictionary captured
printf
The item entered was NOT found!
else:
printf
Item:Quantity:Unit Price"
printfitem:iteminfoQuantity:$iteminfoUnit Price"
def updateinventory item:
Parameters
inventory : nested dictionary for store inventory
function updates quantity unit price or both
for cat, v in inventory.items:
if item in v: # if found
#ask what they want to update
update intinputWhat would you like to update?
Quantity
Price
Both
if update : #quantity
qnt intinputEnter new Quantity:
for sub content in vitems:
if sub item:
contentQuantityqnt
print
Quantity updated"
elif update : # Price
price floatinputEnter new Price $
for sub content in vitems:
if sub item:
contentUnit Price"price
print
Unit Price updated"
elif update :
qnt intinputEnter new Quantity:
price floatinputEnter new Price $
for sub content in vitems:
if sub item:
contentQuantityqnt
contentUnit Price"price
print
Quantity and Unit Price have been updated"
else:
print
Invalid value entered!!"
def main:
while True:
print
Menu
print Display Inventory Content"
print Category Lookup"
print Item Lookup"
print Update Item Info"
print Exit"
print
choice inputEnter your choice:
if choice :
displayinventoryinventory
elif choice :
categorylookupinventory
elif choice :
itemlookupinventory
elif choice :
updateiteminfoinventory
elif choice :
break
else:
printInvalid choice. Please try again."
if namemain:
main
How it should work:
if the user chooses the program is still to display the inventory content but it should ALSO write the information into a CSV file. The file should be called "inventory".
if the user chooses the program is to ask for the category After the category is entered, the program is to do the following
Remember the first letter of each word of the category name is capitalized, for instance "Desk Supplies" Therefore when obtaining the category name from the user, make sure it's converted to the same case.
if the category is not found notify the user this is done already in attached program
If the category is found in addition to what the program displays ADD Total price for each item quantity unit price ALSO write the info into a CSV file. A few important points to If the c
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
