Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def findLowestPrice ( products , discounts ) : total = 0 for test _ case in range ( len ( products ) ) : min

def findLowestPrice(products, discounts):
total =0
for test_case in range(len(products)):
min_price = float('inf')
for i in products[test_case]:
price = int(i[0])
prices =[]
for j in range(1, len(i)):
val =0
if i[j]== 'EMPTY':
val = price
else:
for k in discounts[test_case]:
if k[0]== i[j]:
a, b = int(k[1]), int(k[2])
break
if a ==0:
val = b
elif a ==1:
val = round(price -(price *(b /100)))
elif a ==2:
val = price - b
prices.append(val)
min_price = min(min_price, sum(prices))
total += min_price
return total
fix this code

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Find the derivative of the following functions. f (v) = v 100

Answered: 1 week ago

Question

1. Discuss the main incentives for individual employees.pg 87

Answered: 1 week ago