From the course: Python for Students (2019)

Unlock this course with a free trial

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

What are lists?

What are lists?

- [Instructor] I want to introduce you to another important concept in Python and programming in general: lists. Why are lists important? We often want to group similar things together so that we can perform operations on them. For example, Instagram keeps a list of the people that are following you, so that they can display it on your profile. Or, think about your messaging app. You have a list of people that have sent you messages as well as a list of messages that you've sent. Whenever we need to organize information and access it in a specific order, we turn to lists. Declaring a list in Python is really easy. We separate our values with commas and wrap them in square brackets. Here are four examples of lists in Python. The first one is just a list of numbers. The second one is a list of strengths. We can also combine different data types, which is what I have done in this third example of a list, where we have both numbers and strengths. You can even make…

Contents