How Can We Help?
Introduction:
In this tutorial, we are going to explain how to convert Python sequence to tuple function with basic syntax and many examples for better understanding.
Python sequence to tuple tuple(seq) function is used to convert a sequence into tuple.
Syntax:
tuple(sequence)
Input Parameters:
- sequence : The sequence of values that you want to convert them to tuple.
Example
num = [1,2,3,4]
word='python'
tuple(num)
tuple(word)
Example Output :
(1, 2, 3, 4)
(‘p’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’)
In the above example, ‘tuple(Seq)’ is used to convert a sequence of values into tuple.
In this tutorial, you have learned how to use Python sequence to tuple by using tuple(seq) function.
If you have an inquiry or doubt don’t hesitate to leave them in comment. we are waiting your feedback.But remember to understand the concept very well, you need to practice more.
Hopefully, it was clear and concise.
Similar Python sequence to tuple Function:
- Tuples : is a form of data collection where different type of data can be stored and separated by commas(,).
- min(tuple) : It returns a minimum value of tuple.
- max(tuple) : It returns a minimum value of tuple.
- type(tuple) : It returns a maximum value of tuple.
- len(tuple) : It returns type of tuple, if passed variable is tuple.
- del(tuple) : It deletes whole tuple or individual tuple element or all element of tuple.
Python tutorials list:
- Python tutorials list : access all python tutorials.