【发布时间】:2014-02-06 04:22:18
【问题描述】:
我是 Python 新手,我正在尝试编写一个循环来找到最大的整数 n,因此 n^3
这是我的代码:
working = True
n = 12000
while working:
n = n - 1
if ((n * n * n) < 12000) and not working:
print(n)
【问题讨论】:
-
while True: print("tears") -
您可以使用电源运算符并使用
n ** 3而不是n * n * n
标签: python loops while-loop integer