Python Practice › Tuple Programs › Program 37

Tuple to a string

EasyTuple Programs · 37 of 70

Write a Python program to convert a tuple to a string.

Advertisement
Input
(4, 1, 7, 5)
Output
The given tuple is (4, 1, 7, 5)
4175

Approach

  1. str(t) gives its printed form; join gives just the digits.

Solution

Python
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
Advertisement

Learn the concept

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

More tuple programs

← All 70 Tuple Programs