From the course: Transition from C# to Python

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Iterators

Iterators

From the course: Transition from C# to Python

Start my 1-month free trial

Iterators

- [Instructor] As I mentioned earlier, processing lists and collections of information is a fairly common task in python and the language makes it really easy to perform these operations. One of the ways it accomplishes this is by providing multiple ways of iterating over sets of data which is what we're going to cover in this example. Now I don't have a matching C# file for this example. We're just going to work directly through the python code. So let's open up the Iterators folder and we'll open up iterators_start and here, in my python file you can see that there are a couple of lists containing the days of the week, once in English and once in French, and there's a dictionary that maps each English day to its French counterpart, so let's try some different ways to iterate over these datasets. So one of the easiest ways is to just create an iterator using the global built-in Iter function. So this function creates…

Contents