Python Tuple

Python Tuple

  • A tuple is a sequence of immutable Python objects.

  • Tuple is a also a collection of heterogeneous objects where insertion order is preserved and duplicates are allowed.

  • Tuple also stores the elements on the basis of index only.

When to use a Tuple.

  • Duplicates and insertion order preserved.

  • Not editable.

Ways to create a Tuple.

  • ts = ( )                #Blank Tuple

  • ts = tuple( )       #Blank Tuple 


 


 

Comments

Post a Comment