Question: In this lab, we will learn to: Use lists to store data Import modules Read from and write to files Call functions with arguments Implement

In this lab, we will learn to:
Use lists to store data
Import modules
Read from and write to files
Call functions with arguments
Implement algorithms to compute statistics
Start by downloading 500DayFruitData.txt from D2L. Next you will need to create two files. The names should be
FirstName_LastName_MyProgram.py
FirstName_LastName_Stats.py
In FirstNameLastName_Stats.py create two functions named Mean and Median that calculate the mean and median, respectively. Each one should accept a list of numbers as an argument and return a single number.
Your FirstName_LastName_MyProgram.py should
Get the information from the 500DayFruitData.txt file.
Use the functions defined in FirstName_LastName_Stats.py to calculate
The mean number of apples eaten. (Only include days were apples were eaten).
The median number of apples eaten. (Only include days were apples were eaten).
You don't need to make any calculations for bananas or strawberries.
Output the mean and median values to a file named FirstName_LastName_Output.txt
You should get the following
\table[[Matt_Priem_output.bt-Notepad],[File Edit Format View Help],[The mean number of apples eaten is 6.23],[The median number of apples eaten is 6.50],[\table[[Ln 1, Col 1,100%,Windows (CRLF),UTF-8]]]]
Modify you code so that it prints the average for each fruit and for all of the fruit.
You should get the following
\table[[Matt_Priem_output.txt - Notepad],[File Edit Format View Help],[The mean number of apples eaten is 6.23],[The median number of apples eaten is 6.50],[The mean number of bananas eaten is 6.27],[The median number of bananas eaten is 6.00],[The mean number of strawberries eaten is 5.98],[The median number of strawberries eaten is 6.00],[The mean number of all fruit eaten is 6.16],[The median number of all fruit eaten is 6.00],[Ln 1, Col 1 Windows (CRLF)]]
In this lab, we will learn to: Use lists to store

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!