Question
Why does my cubes_by_four list not contain the right values?
Answer
Some of the most common issues are:
- Using the wrong range: recall that
range()
includes the first number and excludes the stopping number, so if we want to go from 1 to 25, we’d writerange(1, 26)
- Incorrectly checking if the cube is divisible by four: to check if something is evenly divisible by a number, we write
if x % number == 0
- Not cubing the number: to cube something, write
x ** 3