From the course: Programming Foundations: Beyond the Fundamentals

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Creating simple collections

Creating simple collections

- I have a bunch of sheets of paper here that contain related information. I could keep them all laid out on my desk, so I can easily pick up any one of them at any time. But I don't have the desk space to do that for very many sheets. And if I need to do something like copy or scan the whole set, doing it a sheet at a time is pretty inefficient. Instead, I can gather them all up into a stack. (papers rustling) Knowing that these documents are all related means I know that if I need, say, one of the contracts for a certain project, I just need to look in this stack. And if I want to copy all of them, for instance, I could just stick the whole stack in the auto feeder on my copier and let the machine do the rest. One of the simplest types of collection in programming groups pieces of data together in a certain order and assigns the collection a name. In Python, this type of collection is known as a list. To create a…

Contents