Javatpoint Logo
Javatpoint Logo

Python tuple() Function

Python tuple() function is used to create a tuple object.

Signature

Parameters

Iterable: It is a sequence, collection, or an iterator object.

Return

It returns a tuple.

Python tuple() Function Example 1

The below example creates tuple using tuple().

Output:

t1= ()
t2= (1, 6, 9)
t1= ('J', 'a', 'v', 'a')
t1= (4, 5)

Explanation: In the above example, we have taken an empty tuple named as t1 which returns empty values.

In the second case, we have created a tuple from a list, i.e., t2 which return its values.

In the third case, we have created a tuple from the string which returns the string values.

In the fourth case, we have created a tuple from the dictionary, which returns its values.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA