Mastering Python Lists

Mastering Python Lists

11th Grade

15 Qs

quiz-placeholder

Similar activities

Lý thuyết về Python

Lý thuyết về Python

3rd Grade - University

10 Qs

PythonTest

PythonTest

6th Grade - Professional Development

11 Qs

Strings, Lists & Tuples

Strings, Lists & Tuples

9th - 12th Grade

20 Qs

Kuis Python 1

Kuis Python 1

11th Grade

15 Qs

Javascript Lists Lecture Knowledge Check

Javascript Lists Lecture Knowledge Check

9th - 12th Grade

11 Qs

Python - List and Tuples

Python - List and Tuples

11th - 12th Grade

20 Qs

Python List Comprehension Review

Python List Comprehension Review

9th - 12th Grade

10 Qs

Python Lists

Python Lists

9th - 12th Grade

15 Qs

Mastering Python Lists

Mastering Python Lists

Assessment

Quiz

Computers

11th Grade

Easy

Created by

Nicolas Homsi

Used 4+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to add an item to a list in Python?

push

add

insert

append

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you remove an item from a list by value?

Use list.remove(value) to remove an item by value.

Use del list[value] to remove an item by value.

Use list.pop(value) to remove an item by value.

Use list.delete(value) to remove an item by value.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax to join two lists in Python?

list1.merge(list2)

list1.append(list2)

list1 * list2

list1 + list2 or list1.extend(list2)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain how to create a copy of a list in Python.

copied_list = original_list[]

copied_list = list(original_list)

You can create a copy of a list in Python using slicing: copied_list = original_list[:].

copied_list = original_list.copy()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: list1 = [1, 2, 3]; list2 = list1.copy(); list2.append(4)?

[1, 2, 3, 4, 5]

[1, 2, 3]

[1, 2, 3, 4]

[4, 1, 2, 3]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you iterate over a list using a for loop?

for item in my_list:

my_list.forEach(item => { });

for each item in my_list:

for item in range(len(my_list)) :

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between 'append()' and 'extend()' methods in a list?

append() adds multiple elements; extend() adds one element.

append() removes an element; extend() replaces the list.

append() can only be used with strings; extend() can be used with any data type.

append() adds one element; extend() adds multiple elements from an iterable.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?