Link Search Menu Expand Document

Sets

Table of contents

  1. Description
  2. Examples
  3. Mutability

Description

Sets are a comma-separated collection of elements, enclosed by curly braces.

  • Mutable: Their individual elements can be changed.
  • Unique: Each element must be unique. Duplicate values will be eliminated automatically.
  • Unordered: the elements are stored in no specific order.
    • Individual elements cannot be accessed via index numbers or keys.
  • There are many comparison-type actions that can be performed on sets.
  • Python Docs: Sets, Set Types

Examples


Mutability

Sets are mutable, which means you can change their attributes after instantiation.