
Wade A. answered 05/12/19
Experienced Teacher with Specialties in Computer Science and Math
In the extend() method you are extending the list by concatenating another list. For example
x=[1,2]
x.extend([4,5])
will result in x being [1,2,4,5]. This is the same as saying
x=[1,2]
x+=[4,5]
However, with append() you are appending the object passed as an element in the list. Therefore the code
x=[1,2]
x.append([4,5])
will result in [1,2,[4,5]]. This is because you appended a list into the first list. In summary the extend() method will extend a list by joining two lists. The append() method appends the object passed as the last element in the list. I hope that helps.