Now You Try!


Now You Try!

It should print out the the numbers from 1 to 10 that cubes are evenly divisible by four but it must be doing something wrong.

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

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


This excludes 10 from the range. Set the upper bound to 11.

All the even numbers in the range are divisible by 4 when they are cubed (or even squared).


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