GROCERY MANAGEMENT SYSTEM
COMPUTER SCIENCE
(083)
K Srikantha
(PGT CS)
CERTIFICATE
This is to certify that G
Jovan Chandra Reddy student
of class XII A has
successfully completed the
project work entitled
“GROCERY MANAGEMENT SYSTEM”
under the guidance of Smt. K
Srikanta (PGT CS)during the
academic year of 2024-25 in
partial fulfilment of
COMPUTER SCIENCE (083)
AISSCE Practical Examination
conducted by the Central
Board of Secondary Education.
(Signature of external examiner) (signature of principal)
ACKNOWLEDGEMENT
The success of this project
is a result of the
encouragement and guidance of
several individuals. I would
like to express mygratitude
to Shri Roopinder Singh,
Principal of our Vidyalaya,
and my Computer Science
teacher, Smt. K Srikantha,
who critically reviewed the
project and helped in solving
each and every problem which
occurred during
implementation. Special
thanks to all who provided
assistance and motivation.
TABLE OF CONTENTS
Introduction
Features Overview
Code Modules
Hardware and Software
requirements
Source code
Output
Conclusion
Advantages and
Disadvantages
Student Reflections
Bibilography
INTRODUCTION
A Grocery Management System developed in
Python is a software application that helps
users manage their grocery inventory,
purchases, and sales. This system is designed
to simplify the tracking of grocery items,
monitor stock levels, and organize
transactions efficiently. With features like
adding, editing, and deleting products, users
can easily maintain their grocery inventory,
and the system can automatically alert when
items are running low. Python, with its user-
friendly syntax and powerful libraries, makes it
an ideal choice for building such a system. By
leveraging databases or file handling
techniques, the system can store product
details, prices, and quantities. It can also
generate reports on sales, expenses, and
inventory status, helping users make informed
decisions. The goal of this Python-based
Grocery Management System is to streamline
grocery management tasks, reduce human
error, and increase operational efficiency.
Objective:
The primary objective of a Grocery
Management System developed in
Python is to simplify and automate the
processes involved in managing grocery
inventory, purchases, and sales. Key
objectives include:
Efficient Inventory Management: To track
grocery items, their quantities, and stock
levels, ensuring that users can quickly
identify which items are running low or
need to be restocked.
Cost Management: To keep track of the
pricing and total cost of items, allowing
users to manage budgets and avoid
over-spending.
Transaction Handling: To record and
manage purchases, sales, and returns,
maintaining an accurate transaction
history for better tracking and analysis.
FEATURES OVERVIEW
➔SQL Query Execution:
◆Users can execute SQL queries using the !sql
command.
◆Results are dynamically handled, including
pagination for long outputs.
➔Grocery Management:
◆Order items through interactive modals.
◆Dynamically calculate product prices based
on item hypes using geopy.
➔Custom Interaction and UI:
◆Incorporates Discord embeds and modals
for better user interaction.
◆Uses views with buttons for interactive
elements
CODE MODULES
Imports:
The bot uses several essential
libraries:
1. Inventory: Manages the products, their
prices, and quantities.
2. Sales: Handles the sales transactions.
3. Billing: Generates and prints the bill for
customers.
4. Customer: Stores customer
information.
5. Main: Integrates everything and runs
the system.
HARDWARE AND SOFTWARE
REQUIREMENTS
For Windows:
➢Hardware Requirements:
■ Processor: Dual-core processor (2 GHz or
faster)
■ RAM:4GB(8GBrecommendedfor
multitasking)
■ Storage: 10 GB of free disk space
■ Internet: Stable broadband connection
■ Graphics: Integrated graphics (no special
requirements)
➢Software Requirements:
■ Operating System: Windows 10 or later (64-
bit recommended)
■ Python: Python 3.10+ (installed via the
official Python installer)
■ IDE/Text Editor: Visual Studio Code,
PyCharm, or any text editor.
■ Database Tools: MySQL Workbench
For macOS:
➢Hardware Requirements: ■ Processor:
Apple M1/M2 chip or Intel Core i5/i7
processor
■ RAM:4GB(8GBrecommended)
■ Storage: 10 GB of free disk space
■ Internet: Stable broadband connection
■ Graphics: Integrated Apple GPU or Intel Iris
Graphics
➢Software Requirements:
■ Operating System: macOS Big Sur or later
■ Python: Python 3.10+ (via Homebrew or the
Python.org installer)
■ IDE/Text Editor: Visual Studio Code,
PyCharm, or Xcode
■ Database Tools: MySQL Workbench
For Linux:
➢Hardware Requirements:
■ Processor: Dual-core processor (2
GHz or faster) ■
RAM:4GB(8GBrecommended)
■ Storage: 10 GB of free disk space
■ Internet: Stable broadband
connection
■ Graphics: Integrated graphics (no
special requirements)
➢Software Requirements:
■ Operating System: Ubuntu 20.04 LTS
or later, Debian, Fedora, or any modern
Linux distribution.
■ Python: Python 3.10+ (usually pre-
installed in most distributions;
otherwise install via package manager)
■ IDE/Text Editor: Visual Studio Code,
PyCharm, or Nano/Vim for terminal-
based editing
■ Database Tools: MySQL or MariaDB
for databases
SOURCE CODE
import json
# Function to load data from
a JSON file
def load_data():
try:
with
open('grocery_data.json',
'r') as f:
return
json.load(f)
except FileNotFoundError:
return {
'items': [],
'shopping_list': []
}
# Function to save data to a
JSON file
def save_data(data):
with
open('grocery_data.json',
'w') as f:
json.dump(data, f,
indent=4)
# Function to add a new item
def add_item(data):
name = input("Enter item
name: ")
quantity = input("Enter
quantity: ")
category = input("Enter
category: ")
data['items'].append({
'name': name,
'quantity': quantity,
'category': category
})
save_data(data)
print(f"{name} has been
added to the inventory.")
# Function to remove an item
def remove_item(data):
name = input("Enter item
name to remove: ")
data['items'] = [item for
item in data['items'] if
item['name'] != name]
save_data(data)
print(f"{name} has been
removed from the inventory.")
# Function to view all items
in the inventory
def view_items(data):
if data['items']:
print("Grocery
Items:")
for item in
data['items']:
print(f"{item['na
me']} ({item['quantity']}) -
{item['category']}")
else:
print("No items in
the inventory.")
# Function to view the
shopping list
def view_shopping_list(data):
if data['shopping_list']:
print("Shopping
List:")
for item in
data['shopping_list']:
print(item)
else:
print("The shopping
list is empty.")
# Function to add an item to
the shopping list
def
add_to_shopping_list(data):
name = input("Enter item
name to add to shopping list:
")
data['shopping_list'].app
end(name)
save_data(data)
print(f"{name} has been
added to the shopping list.")
# Function to remove an item
from the shopping list
def
remove_from_shopping_list(dat
a):
name = input("Enter item
name to remove from shopping
list: ")
if name in
data['shopping_list']:
data['shopping_list']
.remove(name)
save_data(data)
print(f"{name} has
been removed from the
shopping list.")
else:
print(f"{name} is not
in the shopping list.")
# Function to sort items by
category and display them
def sort_items(data):
category = input("Enter
category to sort by: ")
sorted_items =
sorted(data['items'],
key=lambda x: x['category'])
print(f"Items in
{category} category:")
for item in sorted_items:
if
item['category'].lower() ==
category.lower():
print(f"{item['na
me']} ({item['quantity']})")
# Main program loop
def main():
data = load_data() #
Load data when the program
starts
while True:
print("\nGrocery
Management System")
print("1. Add Item")
print("2. Remove
Item")
print("3. View
Items")
print("4. View
Shopping List")
print("5. Add to
Shopping List")
print("6. Remove from
Shopping List")
print("7. Sort Items
by Category")
print("8. Exit")
choice = input("Enter
your choice: ")
if choice == '1':
add_item(data)
elif choice == '2':
remove_item(data)
elif choice == '3':
view_items(data)
elif choice == '4':
view_shopping_lis
t(data)
elif choice == '5':
add_to_shopping_l
ist(data)
elif choice == '6':
remove_from_shopp
ing_list(data)
elif choice == '7':
sort_items(data)
elif choice == '8':
print("Exiting
the system...")
break
else:
print("Invalid
choice. Please try again.")
# Entry point of the program
if 'name' == '_main_':
main()
Output of the
Source code
Enter your choice: 1
Enter item name: Apples
Enter quantity : 5
Enter category: Fruits
Apples has been added to the inventory.
Enter your choice: 3
Grocery Items:
Apples (5) – Fruits
Enter your choice: 8
Exiting the system...
CONCLUSION..
This bot is a practical implementation
of Python programming for
interactive Discord bots. It
demonstrates the use of advanced
libraries and techniques to create a
multi-feature bot. It highlights the
value of structured development and
testing.
ADVANTAGES AND
DISADVANTAGES
❖ ADVANTAGES:
➢Book According to Your Convenience.
➢Plethora of Options to Choose From.
➢Simple and Easy to Use.
➢Saves You Time.
❖ DISADVANTAGES:
➢Internet Access Required
➢Errors in Booking. Unlike booking at a
counter, there's no one to cross-check your
details before confirmation.
➢People unfamiliar with technology or digital
platforms might find it difficult to book tickets
online.
STUDENT REFLECTIONS
This experience has been an incredible
learning opportunity, filled with challenges,
discoveries, and growth. From the start, I took
responsibility for writing the entire project
code. Developing features required careful
planning, creativity, and problem-solving
skills. I ensured each program component was
functional and user-friendly. Debugging was
challenging yet rewarding, teaching me to
tackle errors systematically. I explored details,
ran test cases, and sought creative solutions to
ensure the program worked seamlessly,
strengthening my analytical thinking and
perseverance. For the database component, I
took it upon myself & found a reliable MySQL
hosting provider, researched solutions, and
integrated the database with my code. This
taught me database management, and
scalable hosting. Successfully connecting the
database was a satisfying milestone. This
project taught me coding, time management,
and critical thinking, boosting my confidence
and passion for programming. I hope it
inspires others to embrace hands-on learning.
Regards,
G Jovan Chandra Reddy
Class: XII A
BIBILOGRAPHY
Developmenting Resources:
https://www.google.com
https://chatgpt.com
https://gemini.google.com
https://discord.gg/
❖ Learning resources:
➢Computer science With Python- Class XII.
By Sumita Arora
_____x_____
END