Can anyone see bug in this bit of code ? Seems to be quite simple.

Oops, try again. Looks like cubes_by_four is the wrong length. It should have 5 values.

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

Can anyone see bug in this bit of code ? Seems to be quite simple.

Oops, try again. Looks like cubes_by_four is the wrong length. It should have 5 values.

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

Hi, @markiscoding ,

The cube of `x`

is `x ** 3`

, not `x ** 4`

.

Also, change your test. You have ...

`if x % 4 == 0`

Test, instead, whether the cube of `x`

mod `4`

is equivalent to `0`

. The instructions have ...

... if the

cubeis evenly divisible by four (my emphasis added)

This is what I've got:

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

print cubes_by_four

Am I getting closer ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.