A computer store manages its laptop inventory by using Python dictionaries. Each dictionary entry has the string name of a specific computer laptop model as a key and its integer quantity in inventory as its corresponding value.
An example:
d = {"MS Surface":47, "HP Laptop Probook":144, "MacBook Pro":23, "Dell Laptop XPS": 10, "Asus Chromebook": 20}
Define a function low_inventory(laptop_dict, threshold) which returns a list of the names of all entries in laptop inventory laptop_dict whose quantities are less than (<) the int threshold.
Example: calling your function as total_items(d,47) should return :
['MacBook Pro', 'Dell Laptop XPS', 'Asus Chromebook']
def low_inventory(laptop_dict, threshold):
for akey in laptop_dict.keys():
if laptop_dict[akey] < threshold:
----
Could you please suggest how to do this. I am new to python and struggling with output.