|
| 1 | +#lex_auth_012693795044450304151 |
| 2 | + |
| 3 | +def calculate_bill_amount(gems_list, price_list, reqd_gems,reqd_quantity): |
| 4 | + bill_amount=0 |
| 5 | + #Write your logic here |
| 6 | + for i in reqd_gems: |
| 7 | + if i not in gems_list: |
| 8 | + bill_amount=-1 |
| 9 | + return bill_amount |
| 10 | + for i in range(len(reqd_gems)): |
| 11 | + k = gems_list.index(reqd_gems[i]) |
| 12 | + |
| 13 | + bill_amount+= price_list[k]*reqd_quantity[i] |
| 14 | + if bill_amount>30000: |
| 15 | + bill_amount= bill_amount-(5/100)*bill_amount #Write your logic here |
| 16 | + return bill_amount |
| 17 | + |
| 18 | +#List of gems available in the store |
| 19 | +gems_list=["Emerald","Ivory","Jasper","Ruby","Garnet"] |
| 20 | + |
| 21 | +#Price of gems available in the store. gems_list and price_list have one-to-one correspondence |
| 22 | +price_list=[1760,2119,1599,3920,3999] |
| 23 | + |
| 24 | +#List of gems required by the customer |
| 25 | +reqd_gems=["Ivory","Emerald","Garnet"] |
| 26 | + |
| 27 | +#Quantity of gems required by the customer. reqd_gems and reqd_quantity have one-to-one correspondence |
| 28 | +reqd_quantity=[3,10,12] |
| 29 | + |
| 30 | +bill_amount=calculate_bill_amount(gems_list, price_list, reqd_gems, reqd_quantity) |
| 31 | +print(bill_amount) |
0 commit comments