# Now You Try It - cubes_by_four isn't a list

#1

Hi! I'm having trouble finding the mistake in my code as the output looks like a list for me and works well:

The error message in my code is: cubes_by_four isn't a list.

I would really appreciate if you could help me
Cheers

``````Replace this line with your code.

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

print cubes_by_four``````

#2

Hello nice to meet you

Try this:

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

#3

it worked, thanks! But I still don't understand why!

The only difference I see between the code you posted and mine is the space between the "=="

#4

here:

cubes_by_four = [--->>> x**3 <<<--- for x in range(1,11) if (x**3) % 4 == 0]

When an exponent is raised, the parentheses are placed, so:

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

#5

But mine worked without the parens???

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

print cubes_by_four

#6

The code is in the original post by @courseninja30070 is fine. Perhaps a strange glitch occurred, and the page needed to be refreshed in order to get it to work.

Regarding the parentheses, @tjsully's code is also correct. The only place where the parentheses are really needed in that expression is in calling the `range` function.

Since some of the parentheses used here are optional, @byteace91888's code also works correctly.

Parentheses can be used to control the order of operations in an expression. See Operator precedence to decide when they are actually needed. However, programmers sometimes use them where they are not required, in order to make the order of operations clear.

#7