#100DaysOfCode in Python Transcripts
Chapter: Days 7-9: Python Data Structures
Lecture: Concepts: what did we learn

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So that's Python data structures. I hope you enjoyed that little overview of lists, tuples, and dictionaries.
0:08 For the next couple of days, you will be working through the exercises outlined in the three-day overview
0:16 which was the second video for this lesson set. But before we get to that, let's just quickly quickly recap everything we've done.
0:24 So for lists, lists can be sorted with sort, go figure. And then worked through how to iterate over a list using a for loop. We also discovered pop.
0:38 Okay, if we remember, pop just returns the item in the index specified. It actually removes it from your list and then returns it.
0:48 del simply deletes it from the list, doesn't even return it. insert does exactly as its name implies. It will insert the second argument
0:59 into the index specified in the first argument. And then append will just tack whatever it is right on to the end of the list.
1:09 Now immutable tuple, okay, we know that this means we can't edit, it can't change, okay. So we've got a tuple.
1:18 We've created it using tuple itself, okay. Now we print out the contents just so you can see that we have the six items in this tuple, my name,
1:31 the letters of my name. And then when we try to manually override it with a simple list substitution there, t[0] we're going to assign the letter m
1:43 and then we get the fact that it's a type error, it's a tuple. You cannot change it, it's immutable, okay. Now onto dictionaries.
1:53 We created it manually. We manually created a dictionary, okay, simple. And then this is how you return the keys using .keys.
2:03 Okay this is just the keys at the front, just the names. Then we returned the values in the same way that we do with the keys.
2:11 We can get just those values, the 30 and the 33s. And then we can get everything as a whole. We can get each item, so the key and the value.
2:22 We can do that using items(). And then we showed you how to iterate over, over the item itself so we can get the keys
2:31 and the values, not just one or the other. And using a forloop, we can then substitute those keys and values into some sort of a string,
2:41 into some sort of text. And that's really useful, something you'll probably do quite a lot. Okay, your turn. So for this next couple of days,
2:52 as we discussed in the ReadMe earlier, we are going to work through the code challenges bite that you have a free code for so go ahead and use that.
3:02 And then for day three, you're going to work through that data.py file which in the repo. So if you have any sort of thoughts on that
3:10 or any confusion on that, just head back to video two where you look at the ReadMe and there's a good explanation there as to what you're going to do
3:19 for days two and three. So that's Python data structures. I hope you enjoyed it. Keep calm and...


Talk Python's Mastodon Michael Kennedy's Mastodon