tuple()

Published Oct 14, 2022
Contribute to Docs

The built-in tuple() function creates a new tuple.

Syntax

tuple_instance(iterable)

The iterable parameter is optional and is an object that can be looped over, such as a list or string. If an iterable is not provided, an empty tuple is created.

Codebyte Example

The following is an example of how the tuple() function is used to create a new tuple from a list:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy