Python tuple() FunctionPython tuple() function is used to create a tuple object. SignatureParametersIterable: It is a sequence, collection, or an iterator object. ReturnIt returns a tuple. Python tuple() Function Example 1The 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. Next TopicPython Built in Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India