Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given some information about a company s employees, you are asked to calculate the percentage of employees for whom working from home is greener than

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,beforeyou use the list, youmustmultiply each distance in the list withyour 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 isby_trainand the second isby_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 ascreenshotinto 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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Describe reviewing applications and rsums.

Answered: 1 week ago

Question

Identify the uses of performance appraisal.

Answered: 1 week ago

Question

Discuss selection in a global environment.

Answered: 1 week ago