Python Test 6 - Sets Which of these about a set is not true?Allows duplicate valuesMutable data typeImmutable data typeData type with unordered values Which of the following is not the correct syntax for creating a set?{1,2,3,4}set((1,2,3,4))set([1,2,2,3,4])set([[1,2],[3,4]]) What will be the output of the following Python code? nums = set([1,1,2,3,3,3,4,4]) print(len(nums))487Error, invalid syntax for formation of set What will be the output of the following Python code? a = [5,5,6,7,7,7] b = set(a) def test(lst): if lst in b: return 1 else: return 0 for i in filter(test, a): print(i,end=" ")5 5 65 6 75 6 7 7 75 5 6 7 7 7 Which of the following statements is used to create an empty set?set(){ }[ ]( ) What will be the output of the following Python code? a={5,4} b={1,2,4,5} a<b{1,2}Invalid operationFalseTrue If a={5,6,7,8}, which of the following statements is false?a[2]=45a.remove(5)print(min(a))print(len(a)) If a={5,6,7}, what happens when a.add(5) is executed?a={5,6,7}a={5,5,6,7}Error as there is no add function for set data typeError as 5 already exists in the set What will be the output of the following Python code? a={4,5,6} b={2,8,6} a+b{4,5,6,2,8,6}{4,5,6,2,8}Error as unsupported operand type for setsError as the duplicate item 6 is present in both sets What will be the output of the following Python code? a={4,5,6} b={2,8,6} a-b{4,5}{6}Error as the duplicate item 6 is present in both setsError as unsupported operand type for set data type What will be the output of the following Python code? a={5,6,7,8} b={7,8,10,11} a^b{5,6,10,11}{5,6,7,8,10,11}{7,8}Error as unsupported operand type of set data type What will be the output of the following Python code? s={5,6} s*3Error as unsupported operand type for set data typeError as multiplication creates duplicate elements which isn’t allowed View Answer{5,6,5,6,5,6}{5,6} What will be the output of the following Python code? a={5,6,7,8} b={7,5,6,8} a==bTrueFalse What will be the output of the following Python code? a={3,4,5} b={5,6,7} a|bInvalid operation{5}{3,4,6,7}{3, 4, 5, 6, 7} Is the following Python code valid? a={3,4,{7,5}} print(a[2][0])Yes, {7,5} is printedError, subsets aren’t allowedError, elements of a set can’t be printedYes, 7 is printed Schreibe einen Kommentar Antworten abbrechenDu musst angemeldet sein, um einen Kommentar abzugeben.