Hi guys I have been trying to create a working python vending machine for over a month now and it doesn't look like I am making any progress. If somebody could help me that could be great :) Here is my program so far:
print ("Welcome to the Vending Machine\n")
total = 0
dr = 1
sn = 3
money=int(input("How much money do you want to insert"))
print ("Prices: Drinks: £1, Snacks: £3\n")
Drinks = {'Coke','Pepsi','Orange Juice', 'Apple Juice','Water'}
Snacks = {'Chocolate', 'Snickers','Twix','Peanuts','Crisp'}
state = 'subtotal'
while total <= money:
    if state != 'total':
    print('')
    print('')
    print ("\nDrinks Menue:")
    print(Drinks)
    print ("Snacks Menue:")
    print(Snacks)
    choice = input("\nEnter the item of your choice: ")
    if choice in Drinks: 
        total += dr
    elif choice in Snacks:
        total += sn
    else:
        state = 'total'
    print("\n\nThat will be a",state,"of £",total)
else:
    print("You have exceeded your inserted money good bye")
I'm trying to make the code reject invalid input and stop when the user has gone over his spending limit.
 
     
    