with python do this ( i only need the code, no need for explanation):
5. View user meals and generate health informationWhen the user chooses 5, the first thing that it should do is to check whether the user information is loaded in the program (i.e., check if the user information is passed to the function that generates recipe recommendations). If the user information is not passed to the function (i.e., the user did not chose option 1 before choosing option 4), call the function that allows the user to either load or create a user profile (option 1 from the main menu). Otherwise, perform the following tasks:• First, check the file username-recipes.txt exists, if the file does not exist, ask the user to generate recipes to view their health information, and call the function that allows the user to do so (i.e., call the function that shows choice 2 from the main menu).• If the file username-recipes.txt exists, open it in read mode and retrieve (i.e., read) all the information that is stored in this file.• Ask the user to enter the number of servings per meal that they would like to perform the health analysis for (integer value).• Write a function that opens the file recipes.csv in read mode and uses the randomly generated recipe names of the user to search for their details from the file recipes.csv. The function should return the details of all the randomly generated recipes by the user.• Pass the information of each recipe to a function that prints all the recipe details like step 3 from (a).• Since the user provided the number of servings per recipe, the calories per meal retrieved from the file recipes.csv should be updated as follows: meal calories = meal calories x serving size.• For each printed meal, check if the calories per serving size cause a caloric surplus or caloric deficit. A caloric surplus happens when the calories per serving for a meal is greater than TEE of the user when divided on the number of meals in a session. Print this status for every meal in the generated report.• Add all the new values of calories to a list for later usage.8• After printing the details of every recipe that the user generated from every session, show the total and average number of calories per session; such information can be found in the file username-recipes.txt. Remember to update the values by multiplying them with the serving size that the user provides.• Check if the user experienced an overall trend of calorie surplus or calorie deficit based on the meals that they generated. To do this, check the following condition:o Compare the total calories for all the meals per session (i.e., the sum of the calories in the list of meal calories) with the user’s TEE. If the total calories are more than TEE, then the user is experiencing a calorie surplus.o Otherwise, the user is experiencing a calorie deficit.• Print the overall trend of the caloric status of the user (surplus or deficit) in each session.• Use matplotlib to plot the list that contains the calories of each recipe from all the sessions using a pie chart plot.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here