Python Language Tuple: Difference between revisions
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
A tuple is a immutable [[Python_Language#Sequence_Types|sequence type]] that contains zero or more elements and whose elements can be of different types. Once a tuple is defined, you can't add, delete or change items. A tuple is similar to a constant [[Python Language List#Overview|list]]. | A tuple is a immutable [[Python_Language#Sequence_Types|sequence type]] that contains zero or more elements and whose elements can be of different types. Once a tuple is defined, you can't add, delete or change items. A tuple is similar to a constant [[Python Language List#Overview|list]]. | ||
=Declaration= | =Declaration= | ||
=Conversion from other Data Structures= | |||
=Tuple Unpacking= | =Tuple Unpacking= | ||
=Exchanging Variable Values= | =Exchanging Variable Values= | ||
Tuples can be used to exchange to variable values without using a third temporary variable. | Tuples can be used to exchange to variable values without using a third temporary variable. |
Revision as of 04:55, 20 January 2022
Internal
Overview
A tuple is a immutable sequence type that contains zero or more elements and whose elements can be of different types. Once a tuple is defined, you can't add, delete or change items. A tuple is similar to a constant list.
Declaration
Conversion from other Data Structures
Tuple Unpacking
Exchanging Variable Values
Tuples can be used to exchange to variable values without using a third temporary variable.