Answered step by step
Verified Expert Solution
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: and 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 ; then you would compute the list which has the following items: and 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.iDevelop an initial decomposition of the problem using the chevron notation and from the module materials. Include your decomposition in your solution document.iiBuilding on your decomposition for part ci 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 from your PIiii.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 ciiYour function must be a translation of your algorithm from part cii otherwise no marks will be awarded.The function should have two arguments: one for each of the two lists. The first argument isbytrainand the second isbycar.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 QOUCU.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 and 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
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