Answers for "how to append value in tuple"

2

how to append value in tuple

a = (3,)
b = list(a)
b.append("Work!")
a = tuple(b)
print(a)
Posted by: Guest on July-25-2021
3

append to a tuple

a = ('tree', 'plant', 'bird')
b = ('ocean', 'fish', 'boat')
# a and b are both tuples

c = a + b
# c is a tuple: ('tree', 'plant', 'bird', 'ocean', 'fish', 'boat')
Posted by: Guest on June-13-2021

Browse Popular Code Answers by Language