Chapters
Python114 chapters

ReferenceBuilt-in functions

tuple()

An ordered sequence that cannot be changed.

Signature

tuple(iterable=())

Parameters

NameMeans
iterablewhat to copy from

Returns

A new tuple.

Example

Python
print(tuple([1, 2]))
print(tuple("ab"))
print(type((5,)).__name__, type((5)).__name__)

Output

(1, 2)
('a', 'b')
tuple int

See also