From the course: Python for Students

Unlock this course with a free trial

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

Creating your first loop

Creating your first loop - Python Tutorial

From the course: Python for Students

Creating your first loop

- [Narrator] I want to share with you another concept in Python called loops. What if you had 100 pictures that you wanted to download, but there was no download all button? What would you do? You would probably open up each picture one by one and click download, or what if you wanted to send the same text message to a list of 100 people, but you didn't want it to be a group text? Again, you would gather the list of phone numbers you wanted to text and one by one send a message. One of the great things about Python and programming languages in general is the way that it can help automate tasks like these, and one of the ways that we do that is through the use of loops. Just in the same way that you would go through every picture and click download, we will give Python a list of items, and then it will go through one by one and perform an action. Let's give it a try. In this program, we have created a variable called pizza_toppings and stored a list with three items, cheese, pepperoni,…

Contents