Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have these datas in 2 dictionaries. dict1 = {A:2, B: 2, C:2} dict2 = {A:2, B:100, C:100) I check values for each keys whether

I have these datas in 2 dictionaries.

dict1 = {"A":2, "B": 2, "C":2} dict2 = {"A":2, "B":100, "C":100) 

I check values for each keys whether values in dict1 is more than values in dict2. Example:

if dict1["A"]>=dict2["A"]: print("There are enough A parts") if dict1["B"]>=dict2["B"]: print("There are enough B parts") 

Is there a way for me to check all values between the 2 dictionaries without having to do the above? Here's how it is for better understanding:

dict1={} dict2 = {"A":2, "B":100, "C":100} productID= "ABBB" #productID quantityInput = 100 quantityToMake = productID*quantityInput #results in ABBB x100 times *** PROGRAM RUNS through each letter and update how many A and Bs are there and updates dict1 

I'm stuck here. The condition is, if I have enough of the parts ie A,B,C,D, as in the case above, I have enough of "A" to make only 2 "ABBB".

If we have the dict2 values for each key as below:

dict2 = {"A":100, "B":2, "C":100} 

I don't have enough B to make 1 "ABBB" since we need 3 "B" to make 1 "ABBB".

Your help is much appreciated. Quite new to python.

Thanks!

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

More Books

Students also viewed these Databases questions

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago