
Python Lambdas and map
Authored by Stephen Robinson
Computers
9th Grade
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of 'number % 2' when 'number' is 8?
0
1
2
8
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid ternary if statement in Python?
`x = 1 if y > 0 else 0`
`x = if y > 0 then 1 else 0`
`x = y > 0 ? 1 : 0`
`x = 1 else 0 if y > 0`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assuming numbers is a list: Which of the following is the correct syntax to use the `map` function with a lambda?
map(lambda x: x + 1, numbers)
map(x: x ** 2, numbers)
map(lambda x: x ** 2)
map(lambda x: x ** 2, numbers)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of object does the `map` function return in Python 3?
List
Tuple
Map object
Dictionary
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct use of the `lambda` to replace a sum function?
lambda x, y: x * y
lambda x, y: x - y
lambda x, y: x + y
lambda x, y: x / y
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
what lambda would be used for a subtract function in place of the add?
:lambda = x+y
lambda x , y: x - y
x= lambda :x-y
x , y lambda y + x:
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct syntax for using `map` with a lambda function that takes two parameters?
map(lambda x: x + 1, list1)
map(lambda x, y: x * y, list1)
map(lambda x, y: x + y, list1, list2)
map(lambda x: x - 1, list2)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?