The tuple() built-in method is used to create a tuple in Python.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
temp_tuple1 = tuple(['a', 'b', 'v', '1', '5', '2', '4', '9', '8','w','z','h'])
print('temp_tuple1 is: ',temp_tuple1)
temp_tuple2 = tuple()
print('temp_tuple2 is: ',temp_tuple2)
Output:
temp_tuple1 is: ('a', 'b', 'v', '1', '5', '2', '4', '9', '8', 'w', 'z', 'h')
temp_tuple2 is: ()
Syntax
tuple(x)
Parameters
The parameter x is an iterable which can be a sequence, collection or an iterator object.
Return Value
The method returns an iterable object.