Search⌘ K

Quiz: Built-in Data Structures

Evaluate your grasp of Python's built-in data structures with this quiz. This lesson helps reinforce your knowledge, ensuring you can effectively utilize these data structures for cleaner and more efficient code.

We'll cover the following...

Choose one possible correct answer(s).

1.

Having a and b as:

a = ['hi', 'happy', 'day']
b = ['bye', 'sad', 'night']

We make a new list l out of a and b as:

l = [('hi', 'bye'), ('happy', 'sad'), ('day', 'night')]

Which of the following pieces of code generates the required l?

A.

l = [(word, antonym) for word in a for antonym in b]

B.

l = [(a[i],b[i]) for i in range(0, 3)]


1 / 6

We hope ...