Example
Set Operations
Adding and removing elements from a set. Basic set operations.
Showing 1–10 of 47
Example
Adding and removing elements from a set. Basic set operations.
Quiz
Free beginner quiz on Python sets: 15 questions on creating sets, add(), update(), remove(), union, intersection, difference and subsets. Instant answers.
Example
Union, intersection and difference of sets. Mathematical operations from set theory.
Example
Checking if a set is a subset or superset of another set.
Example
Sets store only unique elements without a specific order.
Quiz
…float, str, bool, None, lists, tuples, dictionaries and sets, with instant answers.
Challenge
Build a user's settings by copying the defaults and laying their own values on top with update(), so any setting they haven't changed falls back, then warn about unknown keys instead of saving them.
Challenge
Compare yesterday's and today's cargo IDs with set difference to print what was added and what was removed, then count what stayed with an intersection and print none for an empty change.
Challenge
…keeping the first copy, by checking every ID against a set of IDs already seen, then report which IDs came in more than once.
Challenge
Nobody operates an airlock on trust. Each action needs a set of permissions, from basic operator training to the commander's approval for opening the outer hatch, and the airlock's control panel…