Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Building Lists With Python's .append() (Summary)

Python provides a method called .append() that you can use to add items to the end of a given list. This method is widely used either to add a single item to the end of a list or to populate a list using a for loop. Learning how to use .append() will help you process lists in your programs.

In this course, you learned:

  • How .append() works
  • How to populate lists using .append() along with a for loop
  • When to replace .append() with a list comprehension
  • How .append() works in array.array() and collections.deque()

In addition, you explored some examples of how to use .append() to create data structures, such as stacks and queues. This knowledge will allow you to use .append() to grow your lists efficiently and effectively.

Download

Sample Code (.zip)

4.9 KB
Download

Course Slides (.pdf)

1.8 MB

Become a Member to join the conversation.