Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This part provides you with an opportunity to demonstrate your understanding of the problem - solving approach taught in TM 1 1 2 and Python

This part provides you with an opportunity to demonstrate your understanding of the problem-solving approach taught in TM112 and Python functions. Decomposition and algorithms are covered in Block 1 Parts 2 and 4 and Block 2 Part 2. Further examples can be found in Block 2 Part 4. How to define your own functions is introduced in Block 2 Part 4 Section 4.1.3.You will need an individual number in order to answer this question part. You should find your individual number as shown below before you start the question itself.Box: How to obtain your individual numberPerform the following steps with pen and paper you should not write code for these steps:Write down your PI (Personal Identifier). Your PI will be different from your OUCU, but like your OUCU, it is unique to you. The PI starts with a letter followed by 6 digits, followed by a check value, which is either a digit or letter.Identify the last three numerical digits that occur in your PI. So, for instance, if your Open University PI is A987654X, take 654. If your PI is Z1234567, you would take 567.Use the three digits from Step 2, lets call them XYZ, to create the number 0.91XYZ. For instance, if you obtained 654 in Step 2, then you now get 0.91654. If you obtained 567, you now would get 0.91567.In your solution document, in answer to Part ii below, write down your PI and the individual number that you have obtained via Steps 13 from your PI.We ask you to make use of the individual number based on your PI so you can demonstrate that your solution to this question part is your own.If you are unclear about how to use your PI to arrive at the individual number, do not hesitate to ask your tutor for advice.Please state your full PI and the individual number you obtained, so your tutor can establish that the digits you use for XYZ in 0.91XYZ correspond with the final three digits of your PI.You should read the question all the way through before you start to make sure that you understand the scenario.Background to the problem:In Section 1.3.4 of Part 1 of Block 2 Cloud computing, you learned that cloud providers have argued that remote working at home on the cloud is greener than working in an office. The Carbon Trust has, however, pointed out that this is not always true: working at home may cause an overall increase in carbon emissions because it is more efficient to provide lighting and heating to people in an office in comparison to workers running the heating and using lighting in their individual homes.The tipping point in Miles indicates the minimum distance the person needs to travel into work such that home working would be greener for them.Figure 1.19 of Part 1 Block 2 shows the tipping point in Miles for individual commuters as determined by their commuting distance and mode of transportation. For the purpose of this question, you must use the following table which corresponds with part of Figure 1.19:Table 1: showing for two modes of transportation the tipping point in Miles for individual commutersMode of transportationTipping point in MilesBy train32.5By car7.5The problem:Given some information about a companys employees, you are asked to calculate the percentage of employees for whom working from home is greener than travelling into the office.To compute this percentage, you are provided with information in the form of two lists. The first list has an item for each employee who travels by train to work. The item represents the distance they travel into work. The second list contains the travel distances for those travelling by car. You may assume that all employees travel into work by either train or car.Your task is to use this data to compute the percentage of employees for whom remote work is more environmentally beneficial than their traditional commute to the office.For example, the list for those travelling to work by train could be: 60,33,15,230,10 and 10. This list has six items, which means that there are six employees who travel into work by train. Each item represents the distance travelled into work by that employee.However, it is known that employees are overreporting the distance travelled. For this reason, before you use the list, you must multiply each distance in the list with your individual number. Suppose your individual number is 0.91567; then you would compute the list which has the following items: 54.9402,30.217109999999998,13.73505,210.6041,9.1567 and 9.1567. According to this list with adjusted distances, out of the six employees who travel by train, for two of them, working from home would be greener.i.Develop an initial decomposition of the problem using the chevron notation (> and >>) from the module materials. Include your decomposition in your solution document.ii.Building on your decomposition for part c.i., develop an algorithm for solving the problem. Include this algorithm in your solution document, and also write down your PI and the individual number that you have obtained via Steps 13 from your PI.iii.Write a single Python function definition following the instructions that are provided below.Write a single Python function that implements the algorithm you wrote for part c.ii. Your function must be a translation of your algorithm from part c.ii., otherwise no marks will be awarded.The function should have two arguments: one for each of the two lists. The first argument is by_train and the second is by_car.The function should have one return value for the percentage of employees for whom working from home is greener than travelling into the office.Save your function in a file called Q4_OUCU.py, where OUCU is your OUCU number.When you have completed your work on this part:submit the .py file with your functionpaste the function definition from your .py file as text (with indentation preserved) into your solution documentiv.Test the function by calling it with the arguments [60,33,15,230,10,10] and [0.5,1,2,2,4,4,40,23] in IDLE. Paste the function call and the result as a screenshot into your Solution document.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions