Quiz: Built-in Data Structures
Quiz on built-in data structures of Python.
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)]
Question 1 of 60 attempted
Get hands-on with 1400+ tech skills courses.