0 of 8 questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Your time:
Time has elapsed
Good work attempting the practice problems!
Please leave a comment below if you require any clarifications or send an email to [email protected] if you have any comments about this quiz.
You have completed this lesson!
Write a python program that adds two number using python lambda expression?
This response will be reviewed and graded after submission.
Write a python program that finds the cube of a number using lambda expression?
This response will be reviewed and graded after submission.
You are given a list of numbers.
Write a python program that uses lambda expressions to create a function that can be used to double a given value. Create a new list with the new values and display it.
This response will be reviewed and graded after submission.
Write a python program to find the sum of values in a list using python lambda function?
This response will be reviewed and graded after submission.
Write a python program that finds intersection of two array using lambda expression?
Note: This is an advanced use of the filter function. If you’re a complete beginner to programming then it is recommended that you skip this example until you’ve run through the whole course once.
Hint: Recall that filter function returns you a list. How does it create that list? By using the following method:
filter( how_do_I_decide_function, list1)
The filter is going to take 2 params. (1) The first is a function that returns either True or False. (2) The second is a list.
How filter works is that it takes each element from list1 –> puts it into the given function.
The final list is returned back.
This response will be reviewed and graded after submission.
Given a list of dictionaries:
list1 = [{ “name” : “Lechuck”, “age” : 25},
{ “name” : “Wally”, “age” : 8 },
{ “name” : “Guybrush” , “age” : 19 }]
Write a python program to sort list by the dictionary’s age values.
Hint: This will become a lot simpler if you use the lambda function and the sorted function.
Hint 2:
To help you recall, sorted works in the following way:
sorted( list_that_needs_sorting, key = key_function )
key_function = The key function will be consuming each element from the list and return
back a different value. In this case, key_function takes a dictionary
and should return back the value of “age”.
Sorted will pick up each element from the list and pass it to the key_function. It will
collect all the returned values and sort the original list in the same way
as it would sort this list.
This response will be reviewed and graded after submission.
Write a python program to show the odd numbers from a list using a lambda expression and the filter function?
Given: li = [5, 7, 22, 97, 54, 62, 77, 23, 73, 61]
Hint:
To help you recall, filter function has the following syntax:
filter( function_which_helps_decide_True_or_False – AKA whether to keep the element or discard it , the list to be filtered )
This response will be reviewed and graded after submission.
Write a python program that uses a filter function to filter all vowels from a tuple containing number of alphabets?
Given:
sequence = [‘b’, ‘e’, ‘o’, ‘j’, ‘r’, ‘s’, ‘p’, ‘r’]
Hint:
To help you recall, filter function has the following syntax:
filter( function_which_helps_decide_True_or_False – AKA whether to keep the element or discard it , the list to be filtered )
This response will be reviewed and graded after submission.