From the course: Python Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Data structures

Data structures

- [Instructor] We just looked at simple variables that were assigned a single value. But a single value like five or true or false is only so useful. We might want to have an array of values in a variable. So Python has something called data structures, and the first one we're going to look at is a list. So if we say my list is equal to open square bracket closed square bracket, this defines an empty list. And then we can add some values to it with commas, so this is a list of length four. And if we print my list, we see that printed out there. Now we can put really anything we want in a list. So you could have list of strings, and this is a list of length three containing three different strings. Alright, we could also have a list of mixed strings and integers and Booleans and whatever we want. False. We can even throw in another list in there. In fact, you can have a list of lists. Let me just do that. Okay, so we…

Contents