Question: For this problem, you will be required to use a python's list comprehension Complete the function below, , that will take a list of dates

 For this problem, you will be required to use a python's
list comprehension Complete the function below, , that will take a list
of dates in this format: and for each date returns the previous

For this problem, you will be required to use a python's list comprehension Complete the function below, , that will take a list of dates in this format: and for each date returns the previous date in the format where is the month as locale's abbreviation (e.g Jan, Sep, Oct, Dec ctc). The function should therefore also return a list Example: Input Desired Output You can see that in the desired output list, each date is the corresponding previous day from the input list in the format More examples ['1999-81-21'] should return ['20 Jan 1999'] ['1999-81-21', '2822-12-30', '2099-12-21'] should return ['20 Jan 1999', '29 Dec 2022, ' 20 Dec 2099] Question 4 - Basic exception handling You are working on a project with one your fellow software developer and this is what you're told about the below function main(): - The functions and fetch_cost() are very error prone and sometime exceptions are thrown from inside these 2 functions causing the whole code to crash. These 2 functions are very long complex and you should not worry about what happens inside them. - Editing the below code such that if an exception is raised from inside fetch_cost() (i.e if something goes wrong with that function) the program should continue running to the next step, BUT if something goes wrong with fetch_quantiy() or the line cost_per_quantity = cost/qty then it should print the exception and terminate immediately NB: Do not remove any of the original code. Only add to it defmain()=qty=Nonecost=Nane def fetch_quantity(): Renurns a number, any number nan return ... def fetch_cost(): nan Returns a number, any number nnn return .... def compute_cost_per_quantity(): qty = fetch_quantity() cost = fetch_cost() cost_per_quantity = cost/qty return cost_per_quantity cost_per_quantity = compute_cost_per_quantity() a = 1+2+ cost_per_quantity b = 4+5 print (a+b) NB: Do not remove any of the original code. Only add to it

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!