Append vs Extend Let's discover how to change lists. What are lists in Python? Lists are one of the fondamental tools of Python. They are what arrays are for other languages. You can create a list simply like this: mylist = [1,2,3] But you can put everything in a list: strings, objects... anything. names_list = ["John", "Peter", "Mary"] There are different ways to add elements to a list. Let's take a look at them. Two different methods... [caption id="" align="alignnone" width="715"] extend vs append[/caption] With append you can append a single element that will extend the list: >>> a = [ 1 , 2 ] >>> a . append ( 3 ) >>> a [ 1 , 2 , 3 ] If you want to extend more than one element you should use extend, because you can only append one elment or one list of element: >>> a . append ([ 4 , 5 ]) >>> a >>> [ 1 , 2 , 3 ,[ 4 , 5 ]] So ...
How to program with the python language together with tkinter, pygame etc.