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 abcdef
B cdfhjk
printA sortedA
printB sortedB
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
printSymmetric Difference of A and B sortedAsymdiffB
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
