Python Sets


Python Sets

  • Set is collection of heterogeneous objects where insertion order is never preserved and duplicates are never allowed.

  • it does not support slicing and indexing due to unordered element.

  • A set created with 'set' is mutable while the one created with 'frozenset' is immutable.

When to use Set

  • Unique collection of data store.

When to create a Set

  1. st = set ( )                   #Blank Set

  2. st = {0}                       #Blank Set



Post a Comment

Post a Comment (0)