Answer to Question #169949 in Python for Deanna

Question #169949

 Given product code, name, and price for n=7 products as shown in the code snippet

below.

prod = [11, 22, 32, 44, 55, 66, 77]

name = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg'] price = [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7]

Generate a discounted price report given the below discounts:

20% discount if price is more than $400.00

15% discount if price is between $300.00 and $400.00 (both inclusive) 10% discount if price is less than $300.00

Your output should resemble as follows:

      Discounted Price List

No.   Code    Name    Price

1 xxx xxx xxx

2 xxx xxx xxx

...

New Price xxx

xxx


1
Expert's answer
2021-03-09T01:55:23-0500
prod = [11, 22, 32, 44, 55, 66, 77]
name = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg']
price = [300, 400, 500, 200, 505, 606, 707]
print(prod)
print(name)
print(price)
x=0
for i in price:
    price[i] = price(i)
    if(price[i]>=400):
        discountedPrice=price[i]-price[i]*20/100
        print(discountedPrice)
        print(prod[i],name[i],discountedPrice)
    else:
        if(price[i]<400 & price[i]>300):
            discountedPrice=price[i]-price[i]*15/100
            print(discountedPrice)
        else:
            if(price[i]<= 300):
                discountedPrice=price[i]-price[i]*10/100
                print(discountedPrice)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS