What is the difference between append() and extend() on a Python list?

Python Developer Medium

Python Developer — Medium

What is the difference between append() and extend() on a Python list?

Key points

  • append() adds one element; extend() adds multiple elements
  • append() is for single objects; extend() is for iterable objects
  • append() modifies the list by adding one element; extend() modifies the list by adding multiple elements

Ready to go further?

Related questions