Python Practice › Tuple Programs › Program 56
List of lists to tuple of tuples
Write a Python program to convert a list of lists into a tuple of tuples.
Input
[["sqatools"], ["is"], ["best"]]
Output
(('sqatools',), ('is',), ('best',))Approach
tuple(tuple(x) for x in data).
Solution
data = [["sqatools"], ["is"], ["best"]]print(tuple(tuple(x) for x in data))Output
(('sqatools',), ('is',), ('best',))Learn the concept
New to this topic? Read the lesson, then come back.