I understand that one is bitwise operation while the other is not, but how does this bitwise property affect the results of given expression. As both should simply compare the elements in both sets and result in common elements.
set(a) & set(b)
gives the correct answer while finding common elements in set(a) and set(b), while set(a) and set(b)
gives wrong answer.
Python code:
nums2 = [9,4,9,8,4]
nums1 = [4,9,5]
a = set(nums1) and set(nums2)
b = set(nums1) & set(nums2)
print(a)
print(b)
Results:
a = {8, 9, 4}
b = {9, 4}