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

Unlock This Lesson

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

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

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.