Write three functions which calculate the total food cost for each of the three cases

Use this Website to create flowcharts.

https://app.diagrams.net/

 

Question 1. You are throwing a dinner party and need to calculate the cost of the food. However, you don’t know how many guests will show up. The catering company has given you the following estimate for the cost, which depends on the number of people as in the table below.

In addition, if you are a VIP client the catering company gives you a discount of 5% if the number of guests is above 20.

(1) write three functions which calculate the total food cost for each of the three cases.

(2) Next, call the three functions from (1) in a function that first generates a random number of guests between 0 and 100 and then calculates the total cost of the food depending on the number generated.

First, create a step-by-step algorithm and a flowchart and then translate it into a fully functional and documented Python code. Follow the flowchart shape conventions from the session 3 reading, available here.

Question 2.

Write a program which asks the user to enter the names of three celebrities, along with their ages. Then store the information in a data structure (such as lists within a list, a tuple, or a dictionary). You are free to write the program with or without a function.

(1) Using your chosen data structure, calculate the average age of the celebrities.

(2) Calculate the lowest and highest age of the celebrities.

(3) Calculate the difference between your age and each of the three celebrities’ age. Save the difference in a new data structure (such as a list, a tuple, or a dictionary).

(4) For each of the age differences, if the difference is bigger than 0 (your age is higher than a celebrity’s age), print ‘I am old’. Otherwise, print ‘I am young’.

First, create a step-by-step algorithm and a flowchart and then translate it into a fully functional and documented Python code. Follow the flowchart shape conventions from the session 3 reading, available here.

Question 3.

You decided to create a dictionary to store the month of your friends’ birthdays as in the example below:

Birthday_book = {‘Aisha’: 1 , ‘Eman’: 7, ‘Alreem’: 10, ‘Shamma’: 11, ‘Fatma’: 6}

This is only an example, please change the dictionary to reflect your friends’ names and birthday months.

(1) Unfortunately, you incorrectly recorded the birthday months and you need to add 1 to each of the months in the dictionary. Write a function that accomplishes that uses the existing dictionary and adds 1 to each of the month values.

(2) Write another function which extracts only the names of your friends and then stores them in a list. Arrange the names in alphabetical order. Do not do a simple copy and paste from the dictionary into the list.

(3) Write a third function which creates a new dictionary which includes the name of your friend and how much you plan to spend on their birthday present, in AED. Use the existing dictionary and replace the months with the AED amounts.

First, create a step-by-step algorithm and a flowchart and then translate it into a fully functional and documented Python code. Follow the flowchart shape conventions from the session 3 reading, available here.

Your assignment submission needs to include the following resources:

A .pdf file must be the first resource and it will include all the answers to the questions above, including all the python code you produce. Make sure that you submit a neat, clearly presented, and easy-to-read .pdf. The .pdf should be submitted under the name file “student_name.pdf”.

Your second resource must be a single zip file which should include the Jupyter Notebook with extension .ipynb and named “student_name.ipynb”, along with any additional files (e.g. pictures of your flowchart). ***You need to submit two files: (1) pdf file from the first step (primary resource) and (2) a zip file including the ipynb file from the second step (secondary resource).