Solved by Expert Tutors
Solved by Expert Tutors
Question

Hi I cannot get my head around this with this computer science question

on python please can you help me and show me how to work this question out


I really appreciate your help, I have included a screenshot of the question so its easier to read


Many thanks



TMA02 Question 5.png
Question 5 (14 marks)
This question is about Block 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 contains TM112_200_TMA02_05_files. zip (go to TMA02 - Python files and download
TM112_20D_TMA02_Q5files. zip and unzip the file). While you are working on this question, keep all the files in
TM112_20D_TMA02_Q5_files together in that folder. Moving files out of the folder may result in some of the code not working.
Open the folder TM112_20D_TMA02_05_files and inspect the contents of q5. py. The Python list population in q5. py holds UK
population in millions 1990 - 2017 (ONS, 2018). The Python list gas in q5. py holds 28 yearly values for the retail price of gasoline
in the US (in $) (Statista 2019).
a. q5. py imports the Python function median ( ) you used in Block 2 Part 5 to calculate the median of a list of numbers.
Use this function to find the median of the list of the population.
In your Solution document give the median, correct to two decimal places. Also provide the Python code you used for calling
the median() function and explain how you executed it.
(4 marks)
b. In Section 5.1 you were introduced to Polya's four stage process for problem solving. List the four stages
(2 marks)
c. Figure 2 shows a scatterplot of the two python lists in q5. py - population and gas. The python file q5. py imports the function
corr_coef( ) which you used in Section 5.4 of Block 2 Part 5 to calculate the correlation coefficient between two lists.
Use this function to calculate the correlation coefficient and provide the resulting figure rounded to two decimal pl
o
Classify the size of the effect, following Table 5.4 in Block 2 Part 5.
Briefly discuss whether any effect you have found is likely to be causal.
The maximum word limit for the Question 5(c) is 60 words.
(8 marks)
3.5
3.
Price of gasoline in $
2.5
2.
1.5
1.
.......
0.5
0.
56.00
57.00
58.00 59.00
60.00
61.00
62.00
63.00
64.00
65.00
66.00 67.00
UK Population in millions
Figure 2 Price of gasoline in the US (in $) Vs UK Population in millions. Both are from 1990 - 2017.
(Total 14 marks)
References
Office for National Statistics (ONS) (2018) United Kingdom population mid-year estimate [Online]. Available at
https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/timeseries/ukpop (Accessed
2nd October, 2019)
Statista (2019) Retail price of regular gasoline in the United States from 1990 to 2018 [Online]. Available https://www.statista.com/
statistics/204740/retail-price-of-gasoline-in-the-united-states-since-1990/(Accessed 30th January 2019).
References created using the OU Harvard guide to citing references for online materials.

Step-by-step answer

rem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet a


m ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit am


ac, dictum vitae odi

tesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac ma


trices ac magna.


lestie consequat, ultrices a


ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facili



cing elit. Nam lacinia pulvinar


  1. ur laoreet. Nam risus
  2. ng elit. Nam
  3. ipsum dolor sit am
  4. , dictum


dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacin


ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facili


congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus effici


, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Na


, dictum

Donec aliquet. Lorem ipsum dolor sit amet, con


or nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac ma


ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Dosus antonec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor


s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar


ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dap


usce dui le


ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet.


ipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellen


pulv

molestie consequat, ultrices ac magna. Fusce dui lectus, congue ve


molestie consequ

lestie consequat, ultrices ac magna. Fusce dui lectus, congue vel


, ultrices ac magna. F


, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec al


entesque dapibus efficitur laoreet. Nam risu


m ipsum

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Python Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes