Question:
I need help creating a database to store items and their real life tax rates (i.e: foods, electronics, etc.) for my item cost calculator in Python 3
Repl link:
https://replit.com/@SalladShooter/Item-Calculator#main.py
m = True
while m:
finalCost = 0
p = 0
total = 0
item = []
amount = []
cost = []
buying = []
tax = []
array = []
while True:
item.append(input("What item are you buying? "))
amount.append(int(input("How many of your item are you buying? ")))
buying.append(str(amount[p]))
buying.append(str(item[p]))
p = p + 1
cost.append(int(float(input("What is the cost of your item? "))))
tax.append(float(input("What is the tax rate of your item? (In percent) ")))
x = input("Do you want to buy anything else? (y/n) ")
if x != 'y':
break
for i in range(len(item)):
c = cost[i]
a = amount[i]
subTotal = c * a
total = subTotal + (subTotal * (tax[i] / 100))
array.append(total)
for ele in range(0, len(array)):
finalCost = finalCost + array[ele]
finalCost = round(finalCost,2)
amount = str(amount)
string = ' '.join(buying)
print("You are buying %s and the total cost is $%s." %(string,finalCost))
n = input("Do you wan't to calculate again? (y/n) ")
if n != 'y':
m = False