CBSE Class 12 Computer Science
Question 66 of 68
Data Structures - I : Linear Lists — Question 3
Back to all questions 3
Question Use a list comprehension to create a list, CB4. The comprehension should consist of the cubes of the numbers 1 through 10 only if the cube is evenly divisible by four. 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.
CB4 = [x**3 for x in range(1, 11) if (x**3) % 4 == 0]
print(CB4)[8, 64, 216, 512, 1000]