xxxxxxxxxx
# Python3 code to convert a tuple
# into a string using str.join() method
def convertTuple(tup):
str = ''.join(tup)
return str
# Driver code
tuple = ('h','e','l','l',' ','w','o','r','l','d')
str = convertTuple(tuple)
print(str)
xxxxxxxxxx
my_tuple = ('Hello', 'World', '!')
my_string = ''.join(my_tuple)
print(my_string)
xxxxxxxxxx
# Python3 code to convert a tuple
# into a string using a for loop
def convertTuple(tup):
# initialize an empty string
str = ''
for item in tup:
str = str + item
return str
# Driver code
tuple = ('g', 'e', 'e', 'k', 's')
str = convertTuple(tuple)
print(str)