I have the following code mostly working. I just need it to allow the user to input "add-ins" until they enter the sentinel value to exit the loop and have it add the selections up. This is for a class assignment, but this is all I am having difficulties with. Any help would be appreciated.
#start def main(): #create a module - python function to hold main processing #declarations addinArray = ["Whipped Cream", "Cinnamon", "Chocolate sauce", "Amaretto", "Irish whiskey"] priceArray = [0.89, 0.25, 0.59, 1.50, 1.75] #this array holds the add-in prices loopFlag = "" #sentinal value for looping cnt = 0 COFFEECOST = 2 #constant to coffee cost addinName = "" totalCost = 0 #input enter add-in name addinName = input("Enter on Keyboard Coffee Add-in (ex. Whipped Cream, Cinnamon, etc.) or Done to quit") while (addinName != "Done"): #loop until addinName is Done while (cnt < len(addinArray)): if (addinName == addinArray[cnt]) : totalCost = priceArray[cnt] + totalCost print("Add-in ", addinName, " with a price of ", priceArray[cnt]) print( "with a total add-in price so far of ", totalCost) cnt = cnt + 1 #increment counter for next element in array #end while addinName = input("Enter on Keyboard Coffee Add-in (ex. Whipped Cream, Cinnamon, etc.) or Done to quit") #end while totalCost = totalCost + COFFEECOST print("Total cost is: ", totalCost) main() #stop