Math, asked by Shum9875, 11 months ago

Ars gems store sells different varieties of gems to its customers. Write a python program to calculate the bill amount to be paid by a customer based on the list of gems and quantity purchased. Any purchase with a total bill amount above rs.30000 is entitled for 5% discount. If any gem required by the customer is not available in the store, then consider total bill amount to be -1.

Answers

Answered by writersparadise
2

Python program to calculate the bill amount to be paid by customer in Ars Gem store

#Read the inputs from user

gems  = int(input("Enter the Gem Cost: "))

quantity  = int(input("Enter the quantity: "))

 

#Calculate the bill

total = (gems * quantity)

if total >= 30000:

   total = total - (total*(5/100))

elif total == 0:

total = -1

#Display the result

print("The bill Amount for gems purchased is: ",total)

Answered by LoneWolf225
9

Answer:

#PF-Assgn-23

def calculate_bill_amount(gems_list, price_list, reqd_gems,reqd_quantity):

   bill_amount=0

   i=0

   total=0

   leng=len(reqd_gems)

   check =  all(item in gems_list for item in reqd_gems)

   if check is True:

       while(i<leng):

           inty=gems_list.index(reqd_gems[i])

           total=total+ price_list[inty]*reqd_quantity[i]

           bill_amount=total

           i=i+1

       if(bill_amount>30000):

           bill_amount=bill_amount-(bill_amount*5)/100

       else:

           bill_amount=total

   else:

       bill_amount=-1

   return bill_amount

#List of gems available in the store

gems_list=["Emerald","Ivory","Jasper","Ruby","Garnet"]

#Price of gems available in the store. gems_list and price_list have one-to-one correspondence

price_list=[1760,2119,1599,3920,3999]

#List of gems required by the customer

reqd_gems=["Ivory","Emerald","Garnet"]

#Quantity of gems required by the customer. reqd_gems and reqd_quantity have one-to-one correspondence

reqd_quantity=[3,10,12]

bill_amount=calculate_bill_amount(gems_list, price_list, reqd_gems, reqd_quantity)

print(bill_amount)

Step-by-step explanation:

Similar questions