Skip to content

Anshika0998/vending-machine-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

🥤 Vending Machine Simulation (Python)

A Python-based vending machine simulation that allows users to select products, insert money, and receive items with correct change handling.


🚀 Features

  • Display available products with prices
  • User input for item selection
  • Accepts money input from user
  • Validates sufficient balance
  • Dispenses selected item
  • Returns remaining change
  • Handles invalid inputs gracefully

🛠️ Tech Stack

  • Python
  • Core Programming (Loops, Conditionals)
  • (Optional: OOP if used)

📂 Project Structure

vending_machine/
│── vending_machine.py
│── README.md

⚙️ How It Works

  1. The system displays a list of available items with prices.

  2. The user selects a product.

  3. The user inserts money.

  4. The system checks:

    • If the item exists
    • If sufficient balance is provided
  5. If valid:

    • Item is dispensed
    • Remaining change is returned
  6. If invalid:

    • Error message is shown

▶️ How to Run

Step 1: Clone the repository

git clone https://github.com/your-username/vending-machine.git
cd vending-machine

Step 2: Run the program

python vending_machine.py

💡 Example Interaction

Welcome to the Vending Machine!

Available Items:
1. Coke - ₹40
2. Chips - ₹20
3. Chocolate - ₹30

Select item: 1
Insert money: ₹50

Dispensing Coke...
Returning change: ₹10

🔮 Future Improvements

  • GUI version using Tkinter
  • Add more products dynamically
  • Inventory management system
  • Payment integration (UPI simulation)
  • Admin mode for restocking items

About

Simple vending machine program using Python OOP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages