Question: In Python please! Recursive Function please! Write a recursive function rec.work.cost () that takes two arguments, in this order: 1. work.orders: a list of strings

In Python please!In Python please!Recursive Function please! Write a recursive function rec.work.cost () thattakes two arguments, in this order: 1. work.orders: a list of stringsRecursive Function please!

Write a recursive function rec.work.cost () that takes two arguments, in this order: 1. work.orders: a list of strings representing work orders 2. hourly.costs: a tuple of three integers representing the costs per hour to fix a pipe, window and sprin- kler, respectively Each work order in work orders starts with a single digit and is followed by 'pipe', 'window' or ' sprinkler The digit indicates the number of hours that will be spent repairing the given item. For instance, '5sprinkler" indicates that it will take 5 hours to repair a particular sprinkler. For the moment, assuming that hourly.costs - (6, 2, 9). This means that it will cost 5 x $9 $45 to repair the sprinkler. In general, hourly-costs will contain a different trio of values The function recursively processes the entire list of work orders and returns the total cost of performing all the work orders One possible recursive algorithm you can consider implementing is this: if work orders is empty then otherwise return 0 let remaining_costs be the cost of completing all of the other work orders

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!