Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
26
14
150
15K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Answer: B) {2, 3} Because set1 & set2 means set intersection (common elements in both sets). Common items between {1,2,3} and {2,3,4} are {2,3}.
English
0
0
13
971
Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr B. 2 and 3 are the common elements of the 2 sets.
English
0
0
3
595
𝘝𝘦𝘳𝘴𝘦
𝘝𝘦𝘳𝘴𝘦@Abaasaverse·
@PythonPr Answer is B. The algorithm combines the two sets since it's and operator outputs {2, 3}
English
0
0
2
406
λlain.bit
λlain.bit@lainbit·
@PythonPr B) source: #L1822" target="_blank" rel="nofollow noopener">github.com/python/cpython…
λlain.bit tweet media
English
0
0
0
38
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
@PythonPr Answer: B) {2, 3} & is the set intersection operator in Python. It returns elements that exist in both sets. - set1 = {1, 2, 3} - set2 = {2, 3, 4} Common elements -> {2, 3}
English
0
0
0
118
Python Tech
Python Tech@PythonTech43716·
@PythonPr B) Is the right answer Because set store only unique values and here we perform intersection between two set so only common elements from both set will come.
English
0
0
0
11
Paylaş