Lists are a great way of storing multiple items in a single variable. In this tutorial we be appending items to a list, the append method enables us to add new elements to the end of an existing list.
We start by creating a list which can be seen below.
MyList = ['Stevie', 'Robin', 'Dustin', 'Will', 'Jim', 'Nancy']
We then use the append method to add a new element to end of our list.
MyList = ['Stevie', 'Robin', 'Dustin', 'Will', 'Jim', 'Nancy']
MyList.append('Mike')
print (MyList)
The above will out the update list as follows.
['Stevie', 'Robin', 'Dustin', 'Will', 'Jim', 'Nancy', 'Mike']
>>>
the_ad id=’545′]