[Tutor] Can't be that difficult
Curt Hamblin
chamblin850 at gmail.com
Thu Mar 19 16:17:46 EDT 2020
I have two dictionaries:
inv (partNbr(key):qtyOnHand(value), #inventory
need (partNbr(key):qtyNeeded(value) # parts needed for job
the question to answer is : what's in inventory, what has to be ordered
For code :
for partNbr,qtyNeeded in need.items():
print(partNbr, qtyNeeded, inv.get(partNbr,'Not in inventory'))
desired output :
12345 4 8
23456 3 2
34567 2 'Not in Inventory'
this code ALWAYS returns 'Not in Inventory'
More information about the Tutor
mailing list