python - Loop that won't stop? -
i'm new python, , i'm trying write loop find largest integer n n^3 < 12,000. know wrong, don't know what. please help!
here's code:
working = true n = 12000 while working: n = n - 1 if ((n * n * n) < 12000) , not working: print(n)
when found answer, need turn working
flag false
, this
while working: n = n - 1 if ((n * n * n) < 12000): # don't need `and not working:` check print(n) working = false
on side note, in python, can find powers of numbers this
n ** 3 == n * n * n
and turns out that, answer actual question 22
:)
Comments
Post a Comment