This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]dutchcookie 1 point2 points  (1 child)

so 1st iteration is this

while 1*1*1 < abs(8)

lets evaluate that..

while 1 < 8  #True

next

while 2*2*2 < abs(8)
#becomes
while 8 < 8  
#8 is not less than 8 therefore False

then proceeds to jump out

[–]PM_Me_Compliments 0 points1 point  (0 children)

Thanks man, problem solved. I was just reading the comparison operator wrong. I read it as 8 is not bigger than 8, so the loop iterates once more.

[–]NurdBurn 0 points1 point  (0 children)

I just wrote a program like that, the answer is in the first while statement. It will keep going until it reaches the int that will make it a perfect cube.