Computer >> Computer tutorials >  >> Programming >> Python

How to convert a list into a tuple in Python?


You can convert a list into a tuple simply by passing to the tuple function. 

Example

my_list = [1, 2, 3]
my_tuple = tuple(my_list)
print(my_tuple)

Output

This will give the output −

(1, 2, 3)