generate functionTue, 21 Feb 2023

You have to design a Food Ordering app for a restaurant The application will have a log-in for admin and users to log-in -------------------------------- Admin ---------------------------------- ➑️ Admin will have the following functionalities: ⬅️ πŸ‘‰ 1. Add new food items. Food Item will have the following details: πŸ”΄ FoodID //It should be generated automatically by the application. πŸ”΄ Name πŸ”΄ Quantity. For eg, 100ml, 250gm, 4pieces etc πŸ”΄ Price πŸ”΄ Discount πŸ”΄ Stock. Amount left in stock in the restaurant. πŸ‘‰ 2. Edit food items using FoodID. πŸ‘‰ 3. View the list of all food items. πŸ‘‰ 4. Remove a food item from the menu using FoodID

import json def add(): food_id = len(data) + 1 name = input("Enter the name of food item: ") quantity = input("Enter the quantity of the food item: ") price = input("Enter the price of the food item: ") discount = input("Enter the discount of the food item: ") stock = input("Enter the stock of the food item: ") food_data = {'food_id': food_id, 'name': name,'quantity': quantity,'price': price,'discount': discount,'stock': stock} data.append(food_data) print(data) with open('data.json', 'w') as f: json.dump(data, f) def remove(): remove_id = int(input("Enter the food_id you want to remove: ")) for i in data: if i['food_id'] == remove_id: data.remove(i) print(data) with open('data.json',

Questions about programming?Chat with your personal AI assistant