Computer Science, asked by nikitasingla71252, 1 month ago

There is a shop with old-style cash registers. the price of each item is typed manually. Given a list of items and their correct prices, compare the prices to those entered when each item was sold. Determine the number of errors in selling price.

E.g. 

Input: products = ['eggs','milk','cheese'] productPrices = [2.89,3.29,5.79] productsSold = ['eggs','eggs','milk','cheese'] sellingPrices = [2.89,2.99,3.29,5.97] Output: errors = 2​

Answers

Answered by XxitzbdmashbachchixX
0

Answer:

There is a shop with old-style cash registers. the price of each item is typed manually. Given a list of items and their correct prices, compare the prices to those entered when each item was sold. Determine the number of errors in selling price.

E.g. 

Input: products = ['eggs','milk','cheese'] productPrices = [2.89,3.29,5.79] productsSold = ['eggs','eggs','milk','cheese'] sellingPrices = [2.89,2.99,3.29,5.97] Output: errors = 2

Answered by sparthasaradhi
0

Answer:

products = ['eggs','milk','cheese']  

productPrices = [2.89,3.29,5.79]  

productsSold = ['eggs','eggs','milk','cheese']  

sellingPrices = [2.89,2.99,3.29,5.97]

PL = dict(zip(products,productPrices))

print("Product",'Actual','Expected','Error')

for key, value in zip(productsSold,sellingPrices):

if value == PL[key]:

 print(key,value,PL[key],"")

else:

 print(key,value,PL[key],"1")

Explanation:

Similar questions