Ex: If the input of the program is: food.txt and the contents of food.txt are: Sandwiches Ham sandwich Classic ham sandwich Available Sandwiches Chicken salad sandwich Chicken salad sandwich Not available Sandwiches Cheeseburger Classic cheeseburger Not available Salads Caesar salad Chunks of romaine heart lettuce dressed with lemon juice Available Salads Asian salad Mixed greens with ginger dressing, sprinkled with sesame Not available Beverages Water 16oz bottled water Available Beverages Соса-Сola 160z Cоca-Cola Not available Mexican food Chicken tacos Grilled chicken breast in freshly made tortillas Not available Mexican food Beef tacos Ground beef in freshly made tortillas Available Vegetarian Avocado sandwich sliced avocado with fruity spread Not available the output of the program is: Ham sandwich (Sandwiches) Classic ham sandwich -- Caesar salad (Salads) Chunks of romaine heart lettuce dressed with lemon juice -- Water (Beverages) 16oz bottled water -- Beef tacos (Mexican food) Ground beef in freshly made tortillas ---
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Code should be in Python.
Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate lists, and outputs the available food items in the following format: name (category) -- description
Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character ('\t').
(Examples in image)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images