Python Data Structures


Not CompletedSection Introduction

So far in this course, we've discussed a few different data types. We've discussed strings and numbers and both of those data types are relatively straightforward because there is a one to one kind of analogy between numbers and strings with what you use on a day in and day out basis.

Not CompletedOverview of Lists in Python

To start out the section on Python data structures we're going to start talking about Python lists. Now a list in Python if you're coming from other programming languages is like an array. It is a collection of values and that collection can be added to. You can remove items. You can query elements inside of it.

Not CompletedThree Ways to Remove Elements from a Python List

Now that you know the basics of managing the lists in Python let's discuss how we can remove elements from the list and we're actually going to see three different variations of how to remove items and I'm going to explain when it's important and when you'd want to use one versus the other.

Not CompletedGuide to Nested Lists and Best Practices for Storing Multiple Data Types in a Python List

So far in this section, all of our examples of list's have contained a single data type. So right here we have a list of users where each element in the list is a string and another one that you will see quite a bit would be a list of integers. You could do IDs like this. And that is very common and there are some very nice reasons for keeping your data types exactly the same and we'll talk about that in a little bit.

Not CompletedOverview of Python List Query Processes: len(), Negative Indexes, and index()

Now that we've covered some of the various processes for working with Python lists. Now we're going to see some of the popular functions you can use when you are building out programs that utilize these types of collections because there are some very common processes that you're going to use. And it's helpful that Python already built these types of functions for you so you don't have to rebuild them yourself.

Not CompletedHow to Sort Lists in Python

When working with list in python a common process you're going to have to implement is the ability to sort your elements. And so right now by default the way Python works is it takes in your list in this case in our example we have a list of tags each one of these is a string and it is simply sorted by whatever order we added to the list because it's sorted by its index of values.

Not CompletedUsing the join Function in Python to Build a URL Query String

This is going to be a really fun guide because in this guide we're going to go through how to build a practical feature that you could use in some type of application. And we're going to be able to learn about lists and also the join function.

Not CompletedOverview of Ranges in Python Lists

In this lesson, we're going to walk through ranges inside of Python lists now a range if you remember back to when we started working with strings and we saw how we could grab a few set of characters by using ranges and strings. We have this same ability inside of Python list.

Not CompletedAdvanced Techniques for Implementing Ranges and Slices in Python Lists

In the last guide, we walked through ranges in Python lists. Now a very important key to know is that depending on what developer that you're speaking to ranges and the word slices are used many times interchangeably usually ranges are referred to in working with strings. But I have heard a number of developers also refer to them in the same context when working with lists, probably because the syntax is nearly identical.

Not CompletedGuide to the sorted Function in Python

We've walked through one of the potential issues with using the sort function inside of Python lists and that is that it sorts all of the elements in place and there may be times where you do want to perform that action. However, there may also be times where you simply want to sort a list and not change the original one.

Not CompletedHow to Find the Median of a Python List with an Odd Number of Numbers

This is going to be a really fun exercise in this guide. What we're going to do is walk through a relatively non-trivial problem which is how to find the statistical median in a Python list.

Not CompletedWorking with the slice Class in Python to Store Slices

So far in this section on lists in Python we've covered a number of different ways to slice and to work with different ranges inside of python and you may think that I'm going over the top with it because we've covered it from so many different angles and it really does boil down to this type of process.

Not CompletedHow to Add to a List in Python with Both In Place and Copy Processes

In this lesson on Python lists, we're going to see how we can add on to a preexisting list and add additional elements to the end of that list. Now there are a number of ways to do this and we're going to walk through some different variations. The first few we're going to look at are going to make the changes in place. So these are going to be similar to when we use the sort function and we rearrange the items inside of the preexisting lists.

Not CompletedOverview of Python Dictionaries

Now that you should have some familiarity with how to work with lists in Python it's time to move on to our next data structure which is the dictionary. In this guide, We're going to take a high-level overview of what dictionaries are, how to create them, and how to work with them in Python.

Not CompletedGuide to Nested Collections in Python Dictionaries

In the last guide we discussed the overall structure of a basic dictionary in python and in this guide I want to extend that knowledge and talk about nested collections because this is going to be a practice that you see quite a bit.

Not CompletedHow to Add New Key/Value Pairs to Python Dictionaries

In this guide, we're going to extend our knowledge on nested collections inside of Python dictionaries and we're going to see how we can add new key-value pairs.

Not CompletedGuide to Using the get Function in Python Dictionaries to Configure Fallback Lookup Values

So far in this section on Python dictionaries you've seen how we can query elements in a python dictionary collection

Not CompletedGuide to Python Dictionary View Objects

Now that you have a high-level understanding of how dictionaries work such as how to create them how to add to them and multiple ways on how to query the elements inside of them.

Not CompletedOverview of the Multiple Methods for Deleting Items in a Python Dictionary

So far in this section on Python dictionaries, we've walked through a number of ways that we can work with this type of a key-value based data structure and in this guide we're going to see how we can remove elements from a dictionary.

Not CompletedGuide to Working with Lists of Nested Dictionaries

In this lesson, we're going to combine a number of the various techniques that we've worked through in both the list section and the dictionary section. And so we're going to see how you can use both and how one collection can store another one.

Quizzes


Python Data Structures
    Unsupported Browser

    devCamp does not support ancient browsers.
    Install a modern version for best experience.