Python List copy()

Surprisingly, even advanced Python coders don’t know the details of the copy() method of Python lists. Time to change that! Definition and Usage: The list.copy() method copies all list elements into a new list. The new list is the return value of the method. It’s a shallow copy—you copy only the object references to the … Read more

Python List clear()

Surprisingly, even advanced Python coders don’t know about the clear() method of Python lists. Time to change that! Definition and Usage: The list.clear() method removes all elements from an existing list. The list becomes empty again. Here’s a short example: In the first line, you create the list lst consisting of five integers. You then … Read more

Python List remove()

This tutorial shows you everything you need to know to help you master the essential remove() method of the most fundamental container data type in the Python programming language. Definition and Usage: The list.remove(element) method removes the first occurrence of the element from an existing list. It does not, however, remove all occurrences of the … Read more

Python List insert() Method

How can you insert an element at a given index in a given list? Python’s insert() method is your friend. This tutorial shows you everything you need to know to help you master an essential method of the most fundamental container data type in the Python programming language. Definition and Usage: The list.insert(i, element) method … Read more

Python List extend() Method

How can you not one but multiple elements to a given list? Use the extend() method in Python. This tutorial shows you everything you need to know to help you master an essential method of the most fundamental container data type in the Python programming language. Definition and Usage The list.extend(iter) method adds all elements … Read more

How to Go Full-Time ($3000/m) as a Python Freelancer

Python Freelancer

… Without Working Full-Time Hours!          In this article, you are going to learn my exact strategy how to earn $3000 per month as a Python freelancer without actually working full-time and without sacrificing time with your family! This article is based on the following webinar I gave to my community of Python coders. You … Read more

How to Concatenate Lists in Python? [Interactive Guide]

So you have two or more lists and you want to glue them together. This is called list concatenation. How can you do that? These are six ways of concatenating lists: List concatenation operator + List append() method List extend() method Asterisk operator * Itertools.chain() List comprehension Output: What’s the best way to concatenate two … Read more

Python List append() Method

How can you add more elements to a given list? Use the append() method in Python. This tutorial shows you everything you need to know to help you master an essential method of the most fundamental container data type in the Python programming language. Definition and Usage The list.append(x) method—as the name suggests—appends element x … Read more

Python List append() vs extend()

A profound understanding of Python lists is fundamental to your Python education. Today, I wondered: what’s the difference between two of the most-frequently used list methods: append() vs. extend()? I shot a small video explaining the difference and which method is faster—you can play it as you read over this tutorial: Here’s the short answer … Read more

Python List Methods

The most important collection data type in Python is the list data type. You’ll use lists basically in all your future projects so take 3-5 minutes and study this short guide carefully. You can also play my short video tutorial as you read over the methods: Method Description lst.append(x) Appends element x to the list … Read more