Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ Python ] Adjust the following code so that it will subtract the quantity ordered from the inventory: dictionary [ key ] [ ' sub

[Python] Adjust the following code so that it will subtract the quantity ordered from the inventory:
dictionary[key]['sub-key']= dictionary[key]['sub-key']- amount_to_subtract
Then, test the code by saving 5 to the variable quantity, and "salty sailor" to the variable item. Run your subtraction code, then call the stock for salty sailor. How many salty sailor cookies do we have after running your subtraction code?
Dictionary
monday_menu ={'choccy chipper': {'price': 2.50, 'stock': 120},
'fudgy pudgy': {'price': 2.50, 'stock': 120},
'key lime crime': {'price': 4.25, 'stock': 96},
'salty sailor': {'price': 4.40, 'stock': 60},
'blueberry blooper': {'price': 5.00, 'stock': 60}}
Variables:
item = input("What would you like to order? ")
quantity = int(input("How many would you like? "))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions