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('')

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

Step: 3

blur-text-image

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions