Python Practice › Tuple Programs › Program 56

List of lists to tuple of tuples

EasyTuple Programs · 56 of 70

Write a Python program to convert a list of lists into a tuple of tuples.

Advertisement
Input
[["sqatools"], ["is"], ["best"]]
Output
(('sqatools',), ('is',), ('best',))

Approach

  1. tuple(tuple(x) for x in data).

Solution

Python
data = [["sqatools"], ["is"], ["best"]]print(tuple(tuple(x) for x in data))
Output
(('sqatools',), ('is',), ('best',))
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More tuple programs

← All 70 Tuple Programs