1) Read in Menu From File (this is a practice test question) Write…

Question Answered step-by-step 1) Read in Menu From File (this is a practice test question) Write… 1) Read in Menu From File (this is a practice test question)Write function read_menu() that takes one parameter (string datatype), the filename of the menu. The function will return a list of the items and their prices. You can assume the contents of the file are valid.Example file:1 piece of chicken, 3 6 pieces of chicken, 14.95 21 pieces of chicken, 34.95 Popcorn chicken, 5.95 3 wicked wings, 3.95 5 original tenders, 9.95 6 nuggets, 5.95 Original recipe burger, 5.95 Example return value:[[“1 piece of chicken”, 3], [“6 pieces of chicken”, 14.95], [“21 pieces of chicken”, 34.95], [“Popcorn chicken”, 5.95], [“3 wicked wings”, 3.95], [“5 original tenders”, 9.95], [“6 nuggets”, 5.95], [“Original recipe burger”, 5.95]] 2) Order ItemsWrite  function order_items() that takes one parameter (the list of menu items), displays the menu items with the price, and continuously prompts the user to enter their choice. The function then returns the a list of lists containing the items user chose ( [[, ], [, ], …]) . Assume the user will only enter integers.Make sure the function performs in the following order: 1. print the menu in format ) : $Item number will start at 1Item price should be in 2 decimal places2. asks the user to enter their choice or enter 0 to quit. Use the message “Please enter the number of your choice, enter 0 to quit: “3. if the user enters 0, return the list of lists of items chosen. Otherwise, record the choice and go back to step 1.Example run: 1) 1 piece of chicken, 3 2) 6 pieces of chicken, 14.95 3) 21 pieces of chicken, 34.95 4) Popcorn chicken, 5.95 5) 3 wicked wings, 3.95 6) 5 original tenders, 9.95 7) 6 nuggets, 5.95 8) Original recipe burger, 5.95 Please enter the number of your choice, enter 0 to quit: 1 Please enter the number of your choice, enter 0 to quit: 1 Please enter the number of your choice, enter 0 to quit: 0(this will return [[“1 piece of chicken”, 3], [“1 piece of chicken”, 3]] )3) Calculate PricesWrite function calculate_prices()that takes one parameter (the list of lists of chosen items) and returns the total price of the order. You do not need to round the result.4) Charge the userComplete the functions charge(), charge_card(), and charge_cash(). Assume the user will only enter integers.Part 1:Write function charge() that takes one parameter, the total price of the order, asks the user whether they would like to pay with card or cash, and call upon charge_card() or charge_cash() depending on the user’s payment method of choice.Use the message “Would you like to pay with card or cash? Enter 0 for card or 1 for cash: ” when prompting the user to choose their payment methodPart 2:Write function charge_card() that takes one parameter, the total price of the order. The program will ask the user to enter the following:1. card number (if the user does not enter a 16 digit number, spaces allowed, prompt the user to reenter the card number)2. expiration year (the user can enter 2 digits or 4 digits year. The year has to be at least 2021)3. expiration month (prompts the user to enter the month again if the month is invalid)4. CVC (can be 3 or 4 digits. Prompt the user to reenter CVC if the user entered invalid value)If the user did not enter an expiration date that is later than May 2021, print a message ‘Invalid expiration date’, and ask the user to reenter all of the information.Part 3:Write a function charge_cash() that takes one parameter, the total price of the order. The program will ask the user to enter the amount paid with message Amount paid:. If the user entered a value that is not divisible by 5 cents, display message ‘Invalid amount’ and prompt the user to reenter the amount. If the user did not enter enough amount, display the remaining amount due “Remaining amount: $” (in 2 decimal places) and prompt the user to reenter an amount paid. The function should display the change amount and the denominations. IN FORMATdef read_menu(filename):   passdef order_items(ls):   passdef calculate_prices(ls):   passdef charge_card(total):   passdef charge_cash(total):   passdef charge(total):   passdef main():   menu = read_menu(“menu.txt”)   order = order_items(menu)   total = calculate_prices(order)   charge(total)if __name__ == “__main__”:   main() Computer Science Engineering & Technology Python Programming INFO 1110 Share QuestionEmailCopy link Comments (0)