Computer Science, asked by ishitadua22, 9 months ago

Instructions
. The price of each food item(in dollars) is given
• Calculate the total bill by adding the prices and store the result in a
variable called 'total_bill'
• Tax is calculated as 5% of the total bill. Calculate it and store it in a
variable called "tax"
- Add tax with total bill and store the result in 'final_bill'
write the syntax for this in python ​

Answers

Answered by akshayamca14
2

Answer:

def GetTotalBill(food):

   total=0

   for item in food:

       total=total+int(food[item])

   return total

   

done=False

food={}

while done!=True:

   foodname=input('Enter the food item name:')

   price=input('Enter the food price:')

   food[foodname]=price

   userinput=input('Want to add one more item ? If Yes type Y & N for No:')

   if userinput.upper()=='N':

       done=True

       

total_bill=GetTotalBill(food)

tax=total_bill*5/100

final_bill=total_bill+tax

print(str(final_bill))

Explanation:

I dont know what are you look for, but the above code works.

Similar questions