6/18 Why eleven?


#1

cubes_by_four = [i**3 for i in range(1,11) if i**3 % 4 == 0]
print cubes_by_four

Why does the range need to be (1, 11) and not (1, 10)


#2

That's just how the range function inside python works. The two arguments passed give the start and the end of the range, but the end is not included. So if you want to have the numbers from 1 to 10 (10 included) you have to use range(1,11). The second argument is just the point where the function stops. I can recommend reading this post if you want to learn more about the range function.