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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -