Question 1
What will be the result of the following list comprehension in python?
[ x for x in range(1, 10) if x % 2 == 0 ]
Question 2
What is list comprehension in python?
Question 3
What does the following list comprehension do in python?
[ (x, y) for x in range(3) for y in range(3) ]
Question 4
Which of the following is a valid use case for a list comprehension in python?
Question 5
How can you add a conditional statement to a list comprehension in python?
Question 6
Which symbol is used to define a list comprehension in python?
Question 7
Can you nest list comprehensions in python?
Question 8
What does the following list comprehension do in python?
[ x for x in range(1, 6) ]
Question 9
What is the result of the following list comprehension in python?
[word.upper () for word in [hello, world]]
Question 10
How can you square all the elements in a list using a list comprehension?