...

/

Solution Review: Return Even Numbers From 1 to n

Solution Review: Return Even Numbers From 1 to n

Make your own iterator class to return a list of even numbers.

We'll cover the following...

Solution

Notice (in the code below) that the next method in lines 8-13 makes a list, then appends the even numbers in that range to the list using a for loop.

Access this course and 1400+ top-rated courses and projects.