Q:

Advance python code gives wrong output

The variable cubes_by_four should consist of the cubes of the numbers 1 through 10 only if the cube is evenly divisible by four. 
I tried-    
cubes_by_four = [i for i in range(1,10) if (i**3)%4 == 0]
print cubes_by_four

My output is-  
[2, 4, 6, 8]

Problem is- Oops, try again.  Looks like cubes_by_four is the wrong length.  It should have 5 values.  
Online tutorials learning site codeacademy.com  give me the error..
Where should i made the mistakes?  Please Help me. 

A:

Your range(1,10) will return the numbers 1-9.  You need range(1,11) to get the numbers 1-10.  See the docs for full details, but put simply: 
range(start, stop, step) will return a list [start, start + step, start + 2*step, ...] where the final element will be less than stop (assuming that step is positive, if it's negative then it's greater than stop). 
Your list comp then becomes
cubes_by_four = [i for i in range(1,11) if (i**3)%4 == 0]
# [2, 4, 6, 8, 10]

