Lab 8 Goal: Familiar with function. Question: 1. Write a Python function to calculate total calories in a lunch box with following values a. Cookie: 100 Cal/Serve b. Apple: 20 Cal/Serve c. Cheese: 80...

how much


Lab 8 Goal: Familiar with function. Question: 1. Write a Python function to calculate total calories in a lunch box with following values a. Cookie: 100 Cal/Serve b. Apple: 20 Cal/Serve c. Cheese: 80 Cal/Serve d. Butter: 200 Cal/unit Here in lunch box, there are 2 cookies, 1 apple, 1 cheese, and 2 units of butter. Please write a Python function, named MyLunchCalc, accepting the number of cookies (c), the number of apples (a), the number of cheese (ch) and the number of butter (b). Do NOT use above counts directly, instead you HAVE TO use parameters c, a, ch, b in the calculation, so users could provide different values in the future. You can print out answer in the function, or use return statement. Please call the function and show me the total calories of my lunch, for example MyLunchCalc(2, 1, 1, 2). 2. Write a python function named MyFun taking a List of floating point values from the user. Your function will return the answers back in a List containing following three values a. The largest value in the list b. The smallest value in the list c. The value of following formula (max + min)/2 + average of all numbers Call your function with list [1.2, 9.2, 1.5, 0.89, 4.3, 5.8, 3.3, 7.1, 6.5]
Apr 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here