![]() So Astro's is the key and then we have a second dictionary nested inside of it here and now let's set up some key-value pairs. So we have one dictionary here(Teams) and then for Astro's, we have the colon. Whenever you have an open curly bracket you always have to close it off. And so in order to do that, I'm going to use this syntax right hereĪnd in case whatever development environment you're working on doesn't have this kind of autocompletion we can just kind of review here there. So inside the first one, I'm going to say Astro's and then I want the Astro's value to actually be another dictionary. I want the key for each one of these dictionaries to be the name of the team. And so here we have right now teams that has to list items no keys or values are inside of these items but now we can start building that out. I'm going to create two because any more than that that there's going to be a lot of typing I don't think you want to watch me do that. So I'm going to start off with first the list syntax and then we're going to create some keys. So I'm gonna say teams and this is going to be a list that contains various dictionaries so far we've talked about when we talked about nested collections we had lists inside of the value component of dictionaries but now we're going to change it up a little bit and we're going to create a list of teams and this is going to be a list where every element inside of this team's list is going to be a dictionary. ![]() So let's build out our team's database here because this is going to be very similar to what you're going to get back when you run a database query. And also very importantly how to traverse those nested collections you're going to see that that is going to be very helpful in your development career. Now we've talked about nested collections before but I felt like it was so important because this is going to be something that you're working with on a daily basis whether you're working and building out web and mobile applications or if you're working on the machine learning side you're going to have nested collections and being able to understand exactly what that structure looks like.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |