Tuple

From Computer Science Wiki
Jump to: navigation, search
Programming basics[1]

A tuple is a data structure that is an immutable, or unchangeable, ordered sequence of elements. Because tuples are immutable, their values cannot be modified.[2]

As a general rule, tuples use less memory than a listGive a sequence of brief answers with no explanation. or array.

Tuples allows for slicing and indexing like lists, but do not have access for deleting or changing any elements.

Example

# creating a tuple 
mySiblings = ('Susan', 'James', 'Bryan')

# accessing an element within a tuple:

mySiblings[2]

Do you understand this?

Standards

External links

The discussion, examples, and formatting of this digital ocean article may be helpful for you to understand tuples

References