Question 1
In set comprehension, what does the expression x * 2 do in the following example?
my_set={x * 2 for x in range(1, 6)}
Question 2
What is set comprehension in python?
Question 3
What is the output of the following set comprehension?
my_set={x for x in range(1, 11) if x % 2==0}
print(my_set)
Question 4
Which of the following statements about set comprehension is true?
Question 5
What happens if you use set comprehension to create a set with duplicate elements from an iterable?
Question 6
What does the following set comprehension do?
my_set={x for x in range(1, 6) if x % 2==1}
print(my_set)
Question 7
What is the result of the following set comprehension?
my_set={x for x in range(1, 6)}
print(my_set)
Question 8
Which of the following is a valid use of a conditional expression in set comprehension?
Question 9
Which of the following is a valid set comprehension that generates a set of squares of numbers from 1 to 4?
Question 10
Which symbol is used to denote set comprehension in python?