<In what way does your code behave incorrectly? Include ALL error messages.>
After typing in the code (below) I get an error reading “It looks like cubes_by_four isn’t a list” but I can’t figure out what’s wrong with my code? All help previously posted on this forum is the same as what I typed in but mine won’t work?
<What do you expect to happen instead?>
I thought the code was fine, It should return a list of cubed numbers (between 1 and 10) that are also divisible by four.
cubes_by_four = [x3 for x in range(1,11) if (x3) % 4 == 0]
Use a list comprehension to create a list, cubes_by_four.
2)The comprehension should consist of the cubes of the numbers 1 through 10 only if the cube is evenly divisible by four.
3)Finally, print that list to the console.
Note that in this case, the cubed number should be evenly divisible by 4, not the original number."
As you can see, the question asks for cubes of the numbers in the list to be printed if divisible by four. If the question asked fr squares of the numbers then x**2 would be fine.