Код: Выделить всё
import csv
class FoodRestaurant:
"""
Build a food ordering and delivery system using python
lists and dictionaries as storage, store your products
permanently in csv file.
"""
def __init__(self,types_of_food,price_of_food,availability_of_food):
"""constructor method"""
self.types_of_food = types_of_food
self.price_of_food = price_of_food
self.availability_of_food = availability_of_food
self.add_products = [
['Types of Food','Price of Food','availability of Food'],
['okpa',2000,10],
['rice',1500,20],
['akpu',1200,9],
['maize',1000,10],
]
def main(self):
"""main function"""
self._ordering_food()
self._delivering_food()
self.view_all_products()
self.update_product_status()
self._adding_products()
self.delete_product()
self.view_single_product()
def _adding_products(self):
"""Adding food items to a list"""
self.types_of_food = input("Enter Food Type: ")
if len(self.types_of_food)
Подробнее здесь: [url]https://stackoverflow.com/questions/78434930/the-problem-is-that-if-i-add-one-item-while-trying-to-add-another-item-the-fir[/url]