Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Initialize sets A and B A = { ' a ' , ' b ' , ' c ' , ' d ' ,

# 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('')
#Block 1: computes and prints out the set A - B
AminusB = set()
for element in A: # this line runs through every element in A
if not(element in B): #A - B is the set of elements that are in A and are not in B
AminusB.add(element) # Add it AminusB every element in A if the element is also not in B
print('A - B =', sorted(AminusB))
print('')
#Block 2:
BminusA = set()
# put your code here to compute B minus A
print('B - A =', sorted(BminusA))
print('')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What does the Theorem of Pappus say?

Answered: 1 week ago

Question

What types of questions would make up a behavioral interview?

Answered: 1 week ago