Question: Write a function abs_list_lc(values) that takes as input a list of numbers called values, and that uses a list comprehension to create and return a

Write a function abs_list_lc(values) that takes as input a list of numbers called values, and that uses a list comprehension to create and return a list containing the absolute values of the numbers in values. For example:

>>> abs_list_lc([-2, 5, 8, -3]) result: [2, 5, 8, 3] 

Use the built-in abs function (which returns the absolute value of a single number), in conjunction with a list comprehension. This version of the function may not use recursion.

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!