How to create a set in Python?

  • Set is a data type used to store a group of data and hold several objects in a single variable.
  • Sets are written in curly brackets


thisset = {"red", "blue", "green"}


set bi

Set items are:

  • Unordered: The order of the items in a set is not specified.
  • Unchangeable: Set items cannot be changed once created.
  • Unrepeatable: Set does not allow two items with the same value.