The Tech Edvocate

Top Menu

  • Advertisement
  • Apps
  • Home Page
  • Home Page Five (No Sidebar)
  • Home Page Four
  • Home Page Three
  • Home Page Two
  • Home Tech2
  • Icons [No Sidebar]
  • Left Sidbear Page
  • Lynch Educational Consulting
  • My Account
  • My Speaking Page
  • Newsletter Sign Up Confirmation
  • Newsletter Unsubscription
  • Our Brands
  • Page Example
  • Privacy Policy
  • Protected Content
  • Register
  • Request a Product Review
  • Shop
  • Shortcodes Examples
  • Signup
  • Start Here
    • Governance
    • Careers
    • Contact Us
  • Terms and Conditions
  • The Edvocate
  • The Tech Edvocate Product Guide
  • Topics
  • Write For Us
  • Advertise

Main Menu

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings

logo

The Tech Edvocate

  • Start Here
    • Our Brands
    • Governance
      • Lynch Educational Consulting, LLC.
      • Dr. Lynch’s Personal Website
        • My Speaking Page
      • Careers
    • Write For Us
    • The Tech Edvocate Product Guide
    • Contact Us
    • Books
    • Edupedia
    • Post a Job
    • The Edvocate Podcast
    • Terms and Conditions
    • Privacy Policy
  • Topics
    • Assistive Technology
    • Child Development Tech
    • Early Childhood & K-12 EdTech
    • EdTech Futures
    • EdTech News
    • EdTech Policy & Reform
    • EdTech Startups & Businesses
    • Higher Education EdTech
    • Online Learning & eLearning
    • Parent & Family Tech
    • Personalized Learning
    • Product Reviews
  • Advertise
  • Tech Edvocate Awards
  • The Edvocate
  • Pedagogue
  • School Ratings
  • How to create estimates in Buildertrend

  • How to use Bluebeam for punch lists

  • Procore vs Viewpoint features

  • How to submit invoices in Procore

  • How to set up Monday.com for contractors

  • Can PlanGrid track punch lists

  • How to create selections in CoConstruct

  • How to markup drawings in PlanGrid

  • How to use PlanGrid for blueprints

  • How to create custom tools in Bluebeam

Coding
Home›Coding›How to Append a List in Python

How to Append a List in Python

By Matthew Lynch
June 6, 2023
0
Spread the love

Python is a popular programming language that comes with a wide range of features to deal with lists. Lists are used to store multiple items in a single variable, making it easier to manipulate and work with data. If you are a Python programmer, you have probably encountered situations where you need to add new items to an existing list. This is where the append() function comes in. In this article, we will discuss how to append a list in Python.

What is List in Python?

A list is one of the built-in data structures in Python that can hold an ordered collection of items. A list can store a combination of different data types such as integers, floats, strings, and even other lists. Lists are mutable, meaning you can modify them after they have been created.

How to Create a List

Before we jump into the append() function, it is essential to know how to create a list in Python. There are two ways to create a list:

1. Using square brackets []

list_name = [item_1, item_2, item_3, …, item_n]

For example, the following code creates a list of integers:

ages = [20, 22, 23, 25, 26, 30]

2. Using the list() function

list_name = list(iterable)

For example, the following code creates a list of strings:

names = list((“John”, “Peter”, “Sara”))

How to Append a List in Python

Appending a list means adding new items to an existing list. To add an item to a list, we use the append() function, which adds the item to the end of the list. Here is the syntax of the append() method:

list_name.append(item)

For example, let’s say we have an existing list of colors:

colors = [‘red’, ‘green’, ‘blue’]

We can append a new color, say ‘yellow,’ to the end of the list using append():

colors.append(‘yellow’)

Now, our colors list will have ‘yellow’ at the end:

[‘red’, ‘green’, ‘blue’, ‘yellow’]

If we want to append more than one item to the list, we can use the extend() method. The extend() function takes an iterable (list, tuple, set, etc.) as an argument and adds each item to the end of the list.

For example, let’s create a second list of colors to append to the first list:

more_colors = [‘orange’, ‘purple’, ‘pink’]

We can extend our original list with the second list using extend():

colors.extend(more_colors)

Now, our colors list will have all the additional colors at the end:

[‘red’, ‘green’, ‘blue’, ‘yellow’, ‘orange’, ‘purple’, ‘pink’]

Conclusion

Appending a list in Python is a simple and efficient way of adding new items to an existing list. The append() method adds a single item to the end of a list, while the extend() method adds multiple items to the end of a list. Knowing how to append a list in Python is a fundamental skill for any Python programmer, and it’s a process you’ll carry out often when dealing with lists in Python.   

Previous Article

The 10 Most Popular Free Apps Everyone ...

Next Article

iPhone or Samsung: Which Brand Has the ...

Matthew Lynch

Related articles More from author

  • Coding

    How to Use ESLint with the Airbnb JavaScript Style Guide

    June 6, 2023
    By Matthew Lynch
  • CodingDigital & Mobile Technology

    What is a Web Developer?

    April 24, 2023
    By Matthew Lynch
  • Coding

    How to Center Align Text in Your Web Page With CSS

    June 11, 2023
    By Matthew Lynch
  • Coding

    ChatGPT vs Copilot Pro which is the best AI for coding?

    March 28, 2024
    By Matthew Lynch
  • Coding

    A Beginners Guide to RESTful APIs in Node.js

    June 12, 2023
    By Matthew Lynch
  • Coding

    What Are SQL Stored Procedures and How Do You Create Them?

    June 6, 2023
    By Matthew Lynch

Search

Login & Registration

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

About Us

Since technology is not going anywhere and does more good than harm, adapting is the best course of action. That is where The Tech Edvocate comes in. We plan to cover the PreK-12 and Higher Education EdTech sectors and provide our readers with the latest news and opinion on the subject. From time to time, I will invite other voices to weigh in on important issues in EdTech. We hope to provide a well-rounded, multi-faceted look at the past, present, the future of EdTech in the US and internationally.

We started this journey back in June 2016, and we plan to continue it for many more years to come. I hope that you will join us in this discussion of the past, present and future of EdTech and lend your own insight to the issues that are discussed.

Newsletter

Signup for The Tech Edvocate Newsletter and have the latest in EdTech news and opinion delivered to your email address!

Contact Us

The Tech Edvocate
910 Goddin Street
Richmond, VA 23231
(601) 630-5238
[email protected]

Copyright © 2026 Matthew Lynch. All rights reserved.