Python Practice › Tuple Programs › Program 12
Add a list's items to a tuple
Write a Python program to add the items of a list to a tuple.
Input
list [12, 67], tuple (6, 8, 4)
Output
(6, 8, 4, 12, 67)
Approach
- Convert the list to a tuple and concatenate.
Solution
items = [12, 67]t = (6, 8, 4)t = t + tuple(items)print(t)Output
(6, 8, 4, 12, 67)
Learn the concept
New to this topic? Read the lesson, then come back.