Question: Code Text Connect Create a Simple Lambda Function: Write a lambda function that takes a single argument x and returns the square of x .

Code
Text
Connect
Create a Simple Lambda Function: Write a lambda function that takes a single argument x and returns the square of x. Demonstrate its use by passing a number and printing the result.[2 marks]
Lambda with Multiple Arguments: Define a lambda function that takes two arguments, a and b, and returns their product. Use the function to calculate the product of two numbers and print the result.[2 barks]
Combining Lambda with filter() : Given the list of ages, use a lambda function with the filter() function to create a list of all ages that are 18 or above (legal adulthood). Print the filtered list.
ages =[14,18,21,16,30,45,17,22,61]
[4marks]
4. Using Lambda with ) : You have a list of prices in dollars. Use a lambda function with map() to apply a 10% discount to each price. Print the list of discounted prices.
prices =[19.99,35.50,89.99,43.75]
Code Text Connect Create a Simple Lambda

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 Programming Questions!