51. Is the following Python code valid?
a={3,4,{7,5}}
print(a[2][0])
a={3,4,{7,5}}
print(a[2][0])
52. Input order is preserved in sets.
53. What is the purpose of the copy() method for sets?
54. Write a list comprehension for number and its cube for:
l=[1, 2, 3, 4, 5, 6, 7, 8, 9]
l=[1, 2, 3, 4, 5, 6, 7, 8, 9]
55. What is the output of the following code:
set1 = {1, 2}
set2 = {1, 2, 3, 4}
print(set1.issubset(set2))
set1 = {1, 2}
set2 = {1, 2, 3, 4}
print(set1.issubset(set2))
56. If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function:
57. What will be the output of the following Python function?
{x for x in 'abc'}
{x*3 for x in 'abc'}
{x for x in 'abc'}
{x*3 for x in 'abc'}
58. What is the syntax of the following Python code?
>>> a=frozenset(set([5,6,7]))
>>> a
>>> a=frozenset(set([5,6,7]))
>>> a
59. What method is used to find the elements that are present in either of the sets, but not in both sets?
60. What will be the output of the following Python code?
>>> a={5,4}
>>> b={1,2,4,5}
>>> a<b
>>> a={5,4}
>>> b={1,2,4,5}
>>> a<b