From the course: Advanced Python

Unlock this course with a free trial

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

Basic iterators

Basic iterators - Python Tutorial

From the course: Advanced Python

Basic iterators

- [Instructor] The operation of looping over sequences of values is very common in Python, and there are several built-in methods and modules to help out with this. During this chapter, we're going to investigate several different ways of processing sequences of values. The term we use to describe this processing is called iteration. And in this exercise, we'll start off by using some built-in methods to make iterating over sequences quick and easy. Let's open up the Basic_Iterators file. And here, I have two sequences of day name abbreviations in both English and in French. You're probably already familiar with the for in construct, which you can use to create a loop for a given sequence. So this code just loops over the days list and prints the day to the terminal. So let's go ahead and just run that and just see it in action. And sure enough, if you can see the output right here, the days are being printed out on each line. So there might be times when you want more granular access…

Contents