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
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)
Comments
Leave a comment