1a = (1, 2, 3)
2b = a + (4, 5, 6) # (1, 2, 3, 4, 5, 6)
3c = b[1:] # (2, 3, 4, 5, 6)
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)
1tpl1 = ('BMW', 'Lamborghini', 'Bugatti')
2print(tpl1)
3#Now you have to add an item
4tpl1 = list(tpl1)
5print(tpl1)
6tpl1.append('Mercedes Benz')
7tpl1 = tuple(tpl1)
8print(tpl1)
9#*Run the code*
10>> ('BMW', 'Lamborghini', 'Bugatti')
11>> ['BMW', 'Lamborghini', 'Bugatti']
12>> ('BMW', 'Lamborghini', 'Bugatti', 'Mercedes Benz')
13#Task accomplished
1>>> T1=(10,50,20,9,40,25,60,30,1,56)
2>>> L1=list(T1)
3>>> L1
4[10, 50, 20, 9, 40, 25, 60, 30, 1, 56]
5>>> L1.append(100)
6>>> T1=tuple(L1)
7>>> T1
8(10, 50, 20, 9, 40, 25, 60, 30, 1, 56, 100)
1# just add a comma (,) after the value you want to add to the tuple.
2my_tuple = (1,2,3,4,5)
3my_tuple += 6,
4my_tuple += 'hi',
5print(my_tuple)
6
7>>> (1, 2, 3, 4, 5, 6, 'hi')