Python Practice › Tuple Programs › Program 18

List to tuple, doubled

EasyTuple Programs · 18 of 70

Write a Python program to convert a list into a tuple with each element multiplied by 2.

Advertisement
Input
[12, 65, 34, 77]
Output
(24, 130, 68, 154)

Approach

  1. tuple(x * 2 for x in items).

Solution

Python
print(tuple(x * 2 for x in [12, 65, 34, 77]))
Output
(24, 130, 68, 154)
Advertisement

Learn the concept

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

More tuple programs

← All 70 Tuple Programs