Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# Initialize sets A and B A = { ' a ' , ' b ' , ' c ' , ' d ' ,
# Initialize sets A and B
A abcdef
B cdfhjk
printA sortedA
printB sortedB
print
#Block : computes and prints out the set A B
AminusB set
for element in A: # this line runs through every element in A
if notelement in B: #A B is the set of elements that are in A and are not in B
AminusB.addelement # Add it AminusB every element in A if the element is also not in B
printA B sortedAminusB
print
#Block :
BminusA set
# put your code here to compute B minus A
printB A sortedBminusA
print
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started