Python Lambdas and map

Python Lambdas and map

9th Grade

11 Qs

quiz-placeholder

Similar activities

BÀI KIỂM TRA GIỮA KÌ 2 - LỚP 3

BÀI KIỂM TRA GIỮA KÌ 2 - LỚP 3

1st - 10th Grade

10 Qs

CodeHS 5.2

CodeHS 5.2

6th - 10th Grade

15 Qs

IMedia Recap

IMedia Recap

9th - 11th Grade

12 Qs

IT Quiz

IT Quiz

KG - Professional Development

10 Qs

The Most "Hardest" Quiz In "ALL KIND"

The Most "Hardest" Quiz In "ALL KIND"

6th Grade - University

13 Qs

Loops

Loops

9th - 12th Grade

10 Qs

Introduction to Javascript Programming

Introduction to Javascript Programming

9th - 10th Grade

16 Qs

Урок 7 м3

Урок 7 м3

9th Grade

9 Qs

Python Lambdas and map

Python Lambdas and map

Assessment

Quiz

Computers

9th Grade

Medium

Created by

Stephen Robinson

Used 1+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Media Image

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)

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?