THE WORLD'S LARGEST WEB DEVELOPER SITE

Python tuple() Function

❮ Built-in Functions


Example

Create a tuple containing fruit names:

x = tuple(('apple', 'banana', 'cherry'))
Run example »

Definition and Usage

The tuple() function creates a tuple object.

Note: You cannot change or remove items in a tuple.

Read more about sets in the chapter Python Tuples.


Syntax

tuple(iterable)

Parameter Values

Parameter Description
iterable Required. A sequence, collection or an iterator object

❮ Built-in Functions