L = [2, 4, 6, 8, 10]  #use enumerate to get both index and value of a list
for i, val in enumerate(L):
    print(i, val)

"""
Explanation: bookmark : http://nbviewer.jupyter.org/github/jakevdp/WhirlwindTourOfPython/blob/master/10-Iterators.ipynb
End of explanation
"""


L = [2, 4, 6, 8, 10]
R = [3, 6, 9, 12, 15]
for lval, rval in zip(L, R):
    print(lval, rval)

"""
Explanation: zip
Other times, you may have multiple lists that you want to iterate over simultaneously. You could certainly iterate over the index as in the non-Pythonic example we looked at previously, but it is better to use the zip iterator, which zips together iterables:
End of explanation
"""




# find the first 10 square numbers
square = lambda x: x ** 2
for val in map(square, range(10)):
    print(val)



"""
Explanation: map and filter
The map iterator takes a function and applies it to the values in an iterator:
End of explanation
"""




# find values up to 10 for which x % 2 is zero
is_even = lambda x: x % 2 == 0
for val in filter(is_even, range(10)):
    print(val)



"""
Explanation: The filter iterator looks similar, except it only passes-through values for which the filter function evaluates to True:
End of explanation
"""


Next jumping to data science tool 

"""
Explanation: Yields and generators need to revisit to grasp the concept fully. To access the chapter, use this link:
http://nbviewer.jupyter.org/github/jakevdp/WhirlwindTourOfPython/blob/master/12-Generators.ipynb
End of explanation
"""


