Skip to content

Understanding Sets and identifying use cases #5

@space-otter

Description

@space-otter

Build up a good understanding for sets as a data structure and find use cases where it shines.

Set

Definition: Unordered, mutable, no duplicates.

Syntax: my_set = {1, 2, 3}

Common operations & properties:

  • Add: my_set.add(4)
  • Remove: my_set.remove(2)
  • Union: set1 | set2
  • Intersection: set1 & set2
  • Difference: set1 - set2
  • Membership: 3 in my_set

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions