Python tuple() function
Published February 17, 2022The tuple() method in Python is a built-in function that may be used to build a tuple.
The syntax of tuple() function
The tuple() method is written as follows
tuple(iterable) |
where an iterable can be a dictionary, a list, a range, etc.
Example
In the following example, we are going to demonstrate the use of the tuple() function
my_list= [ 1, 2, 3, 4 ] |
Output
(1, 2, 3, 4) |
Read more about python Tuple with different examples
Article Contributed By :
|
|
|
|
204 Views |