In this python tuple program, we will convert a tuple to string datatype.
Steps to solve the program
- Take a tuple input.
- Convert the tuple to a string datatype using str().
- Print the output.
tup = (4,1,7,5)
print("Original tuple: ",tup)
tup1 = str(tup)
print("After converting to a string: ",tup1)
print("Type of new tuple: ",type(tup1))
Output :
Original tuple: (4, 1, 7, 5)
After converting to a string: (4, 1, 7, 5)
Type of new tuple: