Python Sets

0

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

 

Tags

Post a Comment

0Comments
Post a Comment (0)