Skip to main content

List Quiz: 07

Mejbah Ahammad

Python Lists Quiz - Master Level

Python Lists Quiz - Master Level

Answer the following master-level questions about Python lists:

Time Remaining: 10:00

1. What does this code output?

x = [i for i in range(10) if i % 3 == 1]
y = [i * j for i in x for j in range(3) if j > i % 2]
print(y)

2. What does this code output?

x = [[j for j in range(i)] for i in range(1, 5)]
x[1][0] = 10
print(x)

3. What will this code output?

x = [1, 2, 3, 4]
y = [i + j for i, j in zip(x, x[::-1])]
print(y)