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.

Get hands-on with 1200+ tech skills courses.