def height(a):
n=1
while 1:
n=n+1
a=a*2
if a>=8848:
return n
print(height(0.0001,8848))
结果就是下面这样,没答案
"C:\Users\PC\Desktop\Python test\python.exe" "D:/Python test/return.py"
Process finished with exit code 0
def height(a):
n=1
while 1:
n=n+1
a=a*2
if a>=8848:
return n
print(height(0.0001,8848))
结果就是下面这样,没答案
"C:\Users\PC\Desktop\Python test\python.exe" "D:/Python test/return.py"
Process finished with exit code 0
缩进有问题,
而且height(0.0001,8848)有两个参数,函数def height(a)中只有一个参数
def height(a,b):
n=1
while 1:
n=n+1
a=a*2
if a>=b:
return n
print(height(0.0001,8848))