Practice: Set Methods

« Read the chapter

Q21. Update vs union

AdvancedConceptual

When would you prefer union over update?

Goal: Choose correctly.

Q22. Pending students

IntermediateApplication

Given everyone = {'A','B','C','D'} and done = {'B','D'}, print the sorted list of students still pending.

Goal: Apply difference.

Q23. Tag cleanup

IntermediateApplication

Remove the banned tags {'spam', 'ads'} from tags = {'python', 'spam', 'code'} in place and print the sorted tags.

Goal: Apply in-place difference.