hi i am making a vending machine and require some assistance Okay so I need to create a function or something which disables products in a vending machine which there is not enough credit for example if the user has 50p the user can only buy crisps and only crisps should only be shown in what they can buy: Do i need a loop?

prices = [30,50,60]
products = ["juice £0.30","crisps £0.50","chocolate £0.60"]

I think this is simple math. If the amount available - the cost is less-than zero, then you gray the option out, and don't let them choose it. Also, give them the option to insert more coin to make the desired purchase.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.