Skip to content

Python Lists

How to Append a Dictionary to a List in Python Cover Image

How to Append a Dictionary to a List in Python

Python lists are mutable objects that can contain different data types. Because of this, you’ll often find yourself appending items to lists. In this tutorial, you’ll learn how to append a dictionary to a list in Python. While this may

How to Append a String to a List in Python

How to Append a String to a List in Python

Python lists are a common data type you’ll use to store data. Because they’re mutable (meaning they can be changed) and heterogeneous (meaning they can store different types of data), Python lists are very popular. Being able to add items

How to Round to 2 Decimal Places in Python

How to Round to 2 Decimal Places in Python

Being able to work with and round floating point values, or decimal values, in Python is an important skill. In this tutorial, you’ll learn how to round to decimal places in Python, including learning how to round up or down.

Python Array vs List Difference Between Array and List in Python Cover Image

Difference Between Array and List in Python

In this post, you’ll learn the difference between arrays and lists in Python. Both these data structures let you store data in Python and share many similar properties. However, they also let you do quite different things and knowing when

Differences Between Python Lists and Tuples Cover Image

Python: Differences Between Lists and Tuples

In this tutorial, you’ll learn the differences between Python lists and tuples. Lists and tuples are fundamental Python container data structures. On the surface, they seem very similar. However, there are a number of unique differences between them that makes

How to Check if a Python List is Empty

How to Check if a Python List is Empty

In this tutorial, you’ll learn how to use Python to check if a list empty. Python lists are one of the most versatile and widely-used container objects. Because Python lists are iterable, you may often want to first check if

How to Iterate (Loop) Over a List in Python Cover Image

How to Iterate (Loop) Over a List in Python

In this tutorial, you’ll learn how to iterate (or loop) over a list in Python. You’ll learn how to iterate with for loops, while loops, comprehensions, and more. What’s more, is that you’ll learn when each of these methods is

Python map Function Transforming Iterables without Loops Cover Image

Python map Function: Transforming Iterables without Loops

In this tutorial, you’ll learn how to use the built-in Python map() function. This function allows you to process and transform, or “map”, items in an iterable without needing to use a loop to iterate. The function allows you to

Python filter A Complete Guide to Filtering Iterables Cover Image

Python filter: A Complete Guide to Filtering Iterables

The Python filter function is a built-in way of filtering an iterable, such as a list, tuple, or dictionary, to include only items that meet a condition. In this tutorial, you’ll learn how to use the filter() function to filter

Python List Sort Sorting Lists in Python Key Lambda Cover Image

Python List sort(): An In-Depth Guide to Sorting Lists

In this tutorial, you’ll learn how to use Python to sort a list using the sort() method. Being able to work with lists is an essential skill in Python, given their prevalence. Because lists are ordered and mutable data structures, we can modify

Python List Extend Add Elements to a List Cover Image

Python List Extend: Append Multiple Items to a List

In this tutorial, you’ll learn how to use the Python list extend method, which lets you append multiple items to a list. The Python .extend() method is very similar to the Python .append() method, but lets you add multiple elements

Python Find List Index of All Occurences of an Element Cover Image

Python: Find List Index of All Occurrences of an Element

In this tutorial, you’ll learn how to use Python to find the list index of all occurrences of an element. In many cases, Python makes it simple to find the first index of an element in a list. However, because