Set algebra (union, intersection, difference)
📖 Scenario: You are organizing two groups of friends who like different sports. You want to find out who likes either sport, who likes both, and who likes only one of the sports.
🎯 Goal: Build a Swift program that uses sets to find the union, intersection, and difference of two groups of friends.
📋 What You'll Learn
Create two sets of strings representing friends who like basketball and soccer.
Create a variable to hold the union of both sets.
Create a variable to hold the intersection of both sets.
Create a variable to hold the difference of basketball friends who do not like soccer.
Print the results clearly.
💡 Why This Matters
🌍 Real World
Sets help manage groups of items or people, like customers, tags, or preferences, without duplicates.
💼 Career
Understanding set operations is useful in data processing, filtering, and combining information efficiently in software development.
Progress0 / 4 steps