Question 2

Last Updated :
Discuss
Comments

What is the output of this list comprehension?

Python
res = [x**2 for x in range(1, 4)]
print(res)


[1, 2, 3]

[1, 4, 9]

(1, 4, 9)

{1, 4, 9}

Share your thoughts in the comments