Direction: Choose the correct option
Q1.
What is list comprehension in Python?
Direction: Choose the correct option
Q2.
What is the output of `[x for x in range(5)]`?
Direction: Choose the correct option
Q3.
What does `[x**2 for x in range(3)]` produce?
Direction: Choose the correct option
Q4.
How do you include a condition in list comprehension?
Direction: Choose the correct option
Q5.
What is the result of `[i for i in range(3) if i>1]`?
Direction: Choose the correct option
Q6.
Can list comprehension be used with multiple for loops?
Direction: Choose the correct option
Q7.
What is the output of `[x for x in 'abc']`?
Direction: Choose the correct option
Q8.
Which of the following is equivalent to `list(map(lambda x: x*2, [1,2,3]))`?
Direction: Choose the correct option
Q9.
What does `[x if x>0 else 0 for x in [-1,2,0]]` produce?
Direction: Choose the correct option
Q10.
What is the output of `[x for x in range(3)] + [x for x in range(3,6)]`?
