Python Practice › Tuple Programs › Program 18
List to tuple, doubled
Write a Python program to convert a list into a tuple with each element multiplied by 2.
Input
[12, 65, 34, 77]
Output
(24, 130, 68, 154)
Approach
tuple(x * 2 for x in items).
Solution
print(tuple(x * 2 for x in [12, 65, 34, 77]))Output
(24, 130, 68, 154)
Learn the concept
New to this topic? Read the lesson, then come back.