1a = ('tree', 'plant', 'bird')
2b = ('ocean', 'fish', 'boat')
3# a and b are both tuples
4
5c = a + b
6# c is a tuple: ('tree', 'plant', 'bird', 'ocean', 'fish', 'boat')
1apple = ('fruit', 'apple')
2banana = ('fruit', 'banana')
3dog = ('animal', 'dog')
4# Make a list with these tuples
5some_list = [apple, banana, dog]
6# Check if it's actually a tuple list
7print(some_list)
8# Make a tuple to add to list
9new_thing = ('animal', 'cat')
10# Append it to the list
11some_list.append(new_thing)
12# Print it out to see if it worked
13print(some_list)
1First, convert tuple to list by built-in function list().
2You can always append item to list object.
3Then use another built-in function tuple() to
4convert this list object back to tuple.
5You can see new element appended to original tuple representation.
6
7by tutorialspoint.com
8
9happy coding :D
1# METHOD 1:
2tapel = (1,2,3,4)
3tapel.__add__((5,6,7,8)) # -> (1,2,3,4,5,6,7,8)
4
5# METHOD 2:
6tapel = list((1,2,3,4))
7tapel.append((5,6,7,8))
8tapel = tuple(tapel) # -> (1,2,3,4,(5,6,7,8))