Introduction
Managing a restaurant can be a complex and demanding task. From tracking inventory and managing staff schedules to handling customer orders and processing payments, there are many moving parts that need to be coordinated and managed effectively. This is where a restaurant management system comes in.

A restaurant management system is a software application designed to help restaurant owners and managers streamline their operations and improve their bottom line. With features like menu management, inventory tracking, order management, and employee scheduling, a restaurant management system can help restaurant owners and managers save time and reduce errors, while also providing valuable insights into their business performance.
In this project, we will be building a simple restaurant management system using Python. we will provide you complete source code of this project with detail explanation. So ,please read all the contents carefully.Our system will allow restaurant staff to manage menu items, take orders, process payments, and more. By the end of this project, you will have a solid understanding of how to build a basic restaurant management system, as well as some ideas for how you can extend and customize it to meet the needs of your own restaurant or food service business.
Requirements
To build this project, you’ll need to have Python 3 installed on your computer. You’ll also need to install the tabulate
module using the following command:
pip install tabulate
This module will be used to display tables in the console output.
How tabulate module works ?
The tabulate
module is a Python library used for formatting and presenting tabular data in a human-readable format. It provides a simple and convenient way to create tables from lists, dictionaries, or other data structures, and allows users to customize the appearance of the tables.
The tabulate
module can be used for a variety of purposes, including:
- Data analysis:
tabulate
can be used to present data in a clear and concise manner, making it easier to analyze and interpret. - Reporting:
tabulate
can be used to generate tables for reports and presentations, providing a professional and organized look. - Data visualization:
tabulate
can be used to display data in a visually appealing way, helping users to better understand the data. - Command-line applications:
tabulate
can be used to display data in a command-line application, making it easier for users to interact with the application and interpret the data.
Features
The restaurant management system we’ll build will have the following features:
- Display menu: This feature will display the menu items and their prices in a table format.
- Take order: This feature will allow the user to select menu items and add them to an order list.
- Display order: This feature will display the order list along with the total bill amount.
- Modify order: This feature will allow the user to modify the order list by adding or removing menu items.
- Cancel order: This feature will allow the user to cancel the order.
Implementation
Let’s start by creating a new Python file called restaurant.py
. We’ll begin by defining a list of menu items along with their prices:
menu = [ {"number" : 101, "name": "Burger", "price": 50}, {"number" : 102, "name": "Pizza", "price": 72}, {"number" : 103, "name": "Fries", "price": 50}, {"number" : 104, "name": "Salad", "price": 75}, {"number" : 105, "name": "Soft Drink", "price": 102}, {"number" : 106, "name": "Poha", "price": 40}, {"number" : 107, "name": "Sandwitch", "price": 82}, {"number" : 108, "name": "Donuts", "price": 25}, {"number" : 109, "name": "Coke", "price": 77} ]
Next, we’ll define a function called display_menu
that will display the menu items in a table format using the tabulate
module:
from tabulate import tabulate
def display_menu():
headers = ["Item number" , "Menu Item", "Price"]
rows = []
for item in menu:
rows.append([item["name"], item["price"]])
print(tabulate(rows, headers=headers))
Now, let’s define a function called take_order
that will allow the user to select menu items and add them to an order list:
def take_order(): order = [] while True: display_menu() print("Enter item number to add to order or '0' to exit") choice = int(input()) if choice == 0: break valid_choice = False for item in menu: if item["number"] == choice: order.append(item) valid_choice = True break if not valid_choice: print("Invalid item number") return order
The take_order
function will display the menu using the display_menu
function, and prompt the user to enter the item number to add to the order. The function will keep looping until the user enters ‘0’ to exit. Once the user selects an item, the item will be added to the order
list.
In this modified version of the take_order
function, we added a loop that iterates through each item in the menu
list. For each item, we check if the item_number
matches the user’s input choice
. If there is a match, we add the item to the order and set valid_choice
to True
. If there is no match, we print an error message and continue the loop. After the loop, we check if valid_choice
is False
, which means the user entered an invalid item number.
Next, let’s define a function called display_order
that will display the order list along with the total bill amount:
def display_order(order):
headers = ["Menu Item", "Price"]
rows = []
total = 0
for item in order:
rows.append([item["number"], item["name"], item["price"]])
total += item["price"]
rows.append(["Total", total])
print(tabulate(rows, headers=headers))
The display_order
function will display the order list in a table format using the tabulate
module. It will also calculate the total bill amount.
To modify an order, we’ll define a function called modify_order
that will allow the user to add or remove items from the order list:
def modify_order(order):
while True:
display_order(order)
print("Enter 'a' to add item, 'r' to remove item, or '0' to exit")
choice = input()
if choice == '0':
break
elif choice == 'a':
display_menu()
print("Enter item number to add to order or '0' to exit")
item_choice = int(input())
if item_choice == 0:
continue
item = menu[item_choice - 1]
order.append(item)
elif choice == 'r':
print("Enter index of item to remove or '0' to exit")
index = int(input())
if index == 0:
continue
del order[index - 1]
return order
The modify_order
function will display the order using the display_order
function, and prompt the user to enter ‘a’ to add an item, ‘r’ to remove an item, or ‘0’ to exit. If the user selects ‘a’, the function will display the menu using the display_menu
function and prompt the user to enter the item number to add to the order. If the user selects ‘r’, the function will prompt the user to enter the index of the item to remove from the order.
Finally, to cancel an order, we’ll define a function called cancel_order
that will simply return an empty list:
def cancel_order(order):
return []
This function will be called when the user selects the cancel order option.
Putting it all together
Now that we have all the functions defined, let’s put them together in a simple command line interface:
order = []
while True:
print("Select an option:")
print("1. Display menu")
print("2. Take order")
print("3. Display order")
print("4. Modify order")
print("5. Cancel order")
print("6. Exit")
choice = int(input())
if choice == 1:
display_menu()
elif choice == 2:
order = take_order()
elif choice == 3:
display_order(order)
elif choice == 4:
order = modify_order(order)
elif choice == 5:
order = cancel_order(order)
elif choice == 6:
break
else:
print("Invalid choice")
The main
function will display a menu of options and prompt the user to select one. Based on the user’s choice, the function will call the appropriate function (e.g., display_menu
, take_order
, etc.). The function will keep looping until the user selects the exit option.
Complete Source code for Restaurant Management System
menu = [
{"number" : 101, "name": "Burger", "price": 50},
{"number" : 102, "name": "Pizza", "price": 72},
{"number" : 103, "name": "Fries", "price": 50},
{"number" : 104, "name": "Salad", "price": 75},
{"number" : 105, "name": "Soft Drink", "price": 102},
{"number" : 106, "name": "Poha", "price": 40},
{"number" : 107, "name": "Sandwitch", "price": 82},
{"number" : 108, "name": "Donuts", "price": 25},
{"number" : 109, "name": "Coke", "price": 77}
]
from tabulate import tabulate
def display_menu():
headers = ["Item number", "Menu Item", "Price"]
rows = []
for item in menu:
rows.append([item["number"], item["name"], item["price"]])
print(tabulate(rows, headers=headers))
def take_order():
order = []
while True:
display_menu()
print("Enter item number to add to order or '0' to exit")
choice = int(input())
if choice == 0:
break
valid_choice = False
for item in menu:
if item["number"] == choice:
order.append(item)
valid_choice = True
break
if not valid_choice:
print("Invalid item number")
return order
def display_order(order):
headers = ["Item number", "Menu Item", "Price"]
rows = []
total = 0
for item in order:
rows.append([item["number"], item["name"], item["price"]])
total += item["price"]
rows.append(["Total", total])
print(tabulate(rows, headers=headers))
def modify_order(order):
while True:
display_order(order)
print("Enter 'a' to add item, 'r' to remove item, or '0' to exit")
choice = input()
if choice == '0':
break
elif choice == 'a':
display_menu()
print("Enter item number to add to order or '0' to exit")
item_choice = int(input())
if item_choice == 0:
continue
item = menu[item_choice - 1]
order.append(item)
elif choice == 'r':
print("Enter index of item to remove or '0' to exit")
index = int(input())
if index == 0:
continue
del order[index - 1]
return order
def cancel_order(order):
return []
order = []
while True:
print("Select an option:")
print("1. Display menu")
print("2. Take order")
print("3. Display order")
print("4. Modify order")
print("5. Cancel order")
print("6. Exit")
choice = int(input())
print(f"Your option number is {choice}")
if choice == 1:
display_menu()
elif choice == 2:
order = take_order()
elif choice == 3:
display_order(order)
elif choice == 4:
order = modify_order(order)
elif choice == 5:
order = cancel_order(order)
elif choice == 6:
break
else:
print("Invalid choice")
When you run this project, you will get following output
Output
Select an option: 1. Display menu 2. Take order 3. Display order 4. Modify order 5. Cancel order 6. Exit 1 Your option number is 1 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Select an option: 1. Display menu 2. Take order 3. Display order 4. Modify order 5. Cancel order 6. Exit 2 Your option number is 2 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Enter item number to add to order or '0' to exit 101 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Enter item number to add to order or '0' to exit 108 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Enter item number to add to order or '0' to exit 109 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Enter item number to add to order or '0' to exit 106 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 102 Pizza 72 103 Fries 50 104 Salad 75 105 Soft Drink 102 106 Poha 40 107 Sandwitch 82 108 Donuts 25 109 Coke 77 Enter item number to add to order or '0' to exit 0 Select an option: 1. Display menu 2. Take order 3. Display order 4. Modify order 5. Cancel order 6. Exit 3 Your option number is 3 Item number Menu Item Price ------------- ----------- ------- 101 Burger 50 108 Donuts 25 109 Coke 77 106 Poha 40 Total 192
Conclusion
In this mini project, we built a simple restaurant management system using Python. We implemented features for displaying the menu, taking orders, displaying orders, modifying orders, and canceling orders. We also built a simple command line interface to tie everything together. While this restaurant management system is quite simple, it demonstrates the power of Python in building real-world applications.