Python Practice › Tuple Programs › Program 37
Tuple to a string
Write a Python program to convert a tuple to a string.
Input
(4, 1, 7, 5)
Output
The given tuple is (4, 1, 7, 5) 4175
Approach
str(t)gives its printed form;joingives just the digits.
Solution
t = (4, 1, 7, 5)print("The given tuple is " + str(t))print("".join(map(str, t)))Output
The given tuple is (4, 1, 7, 5) 4175
Learn the concept
New to this topic? Read the lesson, then come back.