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