0% found this document useful (0 votes)
20 views2 pages

PYCODE

The document outlines a simple hotel management system that allows users to add, view, delete, and update dishes in a menu. It includes functions for each operation and a main loop to interact with the user. The menu is represented as a dictionary with dish names as keys and their prices as values.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

PYCODE

The document outlines a simple hotel management system that allows users to add, view, delete, and update dishes in a menu. It includes functions for each operation and a main loop to interact with the user. The menu is represented as a dictionary with dish names as keys and their prices as values.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

menu = {"Pasta": 150, "Pizza": 250, "Burger": 100}

def add_dish():

name = input("Enter dish name: ")

price = float(input("Enter dish price: "))

menu[name] = price

print("Dish added successfully.")

def view_menu():

if not menu:

print("Menu is empty.")

else:

print("Menu:")

for name, price in menu.items():

print(f"{name} - Rs. {price}")

def delete_dish():

name = input("Enter dish name to delete: ")

if name in menu:

del menu[name]

print("Dish removed successfully.")

else:

print("Dish not found.")

def update_dish():

name = input("Enter dish name to update: ")

if name in menu:

menu[name] = float(input("Enter new price: "))

print("Dish updated successfully.")

else:

print("Dish not found.")

def main():
options = {"1": add_dish, "2": view_menu, "3": delete_dish, "4": update_dish}

while True:

print("\nHotel Management System")

print("1. Add Dish\n2. View Menu\n3. Delete Dish\n4. Update Dish\n5. Exit")

choice = input("Enter your choice: ")

if choice == "5":

print("Exiting...")

break

options.get(choice, lambda: print("Invalid choice, try again."))()

if __name__ == "__main__":

main()

You might also like