Python Practice › Tuple Programs › Program 12

Add a list's items to a tuple

EasyTuple Programs · 12 of 70

Write a Python program to add the items of a list to a tuple.

Advertisement
Input
list [12, 67], tuple (6, 8, 4)
Output
(6, 8, 4, 12, 67)

Approach

  1. Convert the list to a tuple and concatenate.

Solution

Python
items = [12, 67]t = (6, 8, 4)t = t + tuple(items)print(t)
Output
(6, 8, 4, 12, 67)
Advertisement

Learn the concept

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

More tuple programs

← All 70 Tuple Programs