Question
This question is aboutBlock 2 Part 5. This question requires you to calculate values using Python functions. There are two approaches you can use. Add
This question is aboutBlock 2 Part 5. This question requires you to calculate values using Python functions. There are two approaches you can use.
- Add suitable code to the provided file, then run it.
- Run the provided file first, to load the required function and data into memory, then do the calculation in the interactive Python shell.
Feel free to choose the approach you prefer.
The download folder for this TMA containsTM112_21D_TMA02_Q5_files.zip(go toTMA02-Python filesand downloadTM112_21D_TMA02_Q5_files.zipand unzip the file). While you are working on this question, keep all the files inTM112_21D_TMA02_Q5_filestogether in that folder. Moving files out of the folder may result in some of the code not working.
Open the folderTM112_21D_TMA02_Q5_filesand inspect the contents ofq5.py. The Python listworked_from_home_onlyinq5.pyholds 17 weekly values for the percentage of working adults working from home only from May to September 2020 (Office for National Statistics, 2020). The Python listtravelled_to_work_onlyinq5.pyholds 17 weekly values for percentage of working adults travelling to work only for the same period (Office for National Statistics, 2020).
- a.q5.pyimports the Python functionmedian()you used inBlock 2 Part 5to calculate the median of a list of numbers.
- Use this function to find the median ofworked_from_home_only.
- In your Solution document give the median. Also provide the Python code you used for calling themedian()function and explain how you executed it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started