The tuple() method converts a list of items into tuples.
Following is the syntax for tuple() method −
tuple( seq )
seq − This is a tuple to be converted into tuple.
This method returns the tuple.
The following example shows the usage of tuple() method.
#!/usr/bin/python3 list1 = ['maths', 'che', 'phy', 'bio'] tuple1 = tuple(list1) print ("tuple elements : ", tuple1)
When we run above program, it produces the following result −
tuple elements : ('maths', 'che', 'phy', 'bio')