Tuples: Immutable Sequences : Introduction « Tuple « Python Tutorial






# Tuple can be used as keys in mappings-lists can't be.
# Tuple are returned by some built-in functions and methods.
# The tuple syntax is simple-if you separate some values with commas, you automatically have a tuple:

x = 1, 2, 3
print x

# Tuples may also be enclosed in parentheses:

x = (1, 2, 3)
print x

# The empty tuple is written as two parentheses containing nothing:

x = ()
print x








6.1.Introduction
6.1.1.Tuples: Immutable Sequences
6.1.2.How to write a tuple containing a single value.
6.1.3.Single-Element Tuples
6.1.4.One comma can change the value of an expression completely:
6.1.5.Using Tuples
6.1.6.Assigning Multiple Values at Once
6.1.7.Built-in Functions