Create a program that allows someone to purchase items from a vending machine…you should have at least 5 Items in the vending machine, each with varying need to display the item and the price…people can purchase more than one of any single item…and they can purchase more than one item during the transaction…you need to keep a running total of the purchase…also allow the user to enter how much money they are giving the vending machine…calculate the change…as always, make sure you create exception handling…

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

# Add imports
import os;
# Main Function
def main():
    # Function calls
# Display Price Menu Function
def dispPri():
    # Prints menu items
    print("Vending Machine Item List")
    print("ID:\tDesciption \tCost: ")
    print(" 1\tP. Chips \t$0.50")
    print(" 2\tPretzels \t$0.45")
    print(" 3\tFruit Pie \t$0.75")
    print(" 4\tGum       \t$0.30")
    print(" 5\tHoney Bun \t$0.65")
    print(" 6\tCookies   \t$1.00")
    print(" 0\tExit")
# Purchase Items function
def purchItems():
    # Open file to write to a file
    fh = open("vending.txt", "w")
    # Declare and initialize money amount

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats