Question: Compute A B and output the resulting set. Note that according to the definition of a set, the order of the elements does not matter.

Compute AB and output the resulting set.
Note that according to the definition of a set, the order of the elements does not matter. In this code, the elements of a set are printed in sorted order so that your output will match the expected output in the test cases. Initialize sets A and B
A ={'a','b','c','d','e','f'}
B ={'c','d','f','h','j','k'}
print('A =', sorted(A))
print('B =',sorted(B))
print('')
AsymdiffB = set()
# put your code here to compute the symmetric difference of A and B
# first add all the elements that are in A but not B
# then add all the elements that are in B but not A
print('Symmetric Difference of A and B =', sorted(AsymdiffB))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!