倒计时函数只返回一个值
Countdown Function Only Returning One Value
第二个函数有什么问题?
def count(n):
return [i for i in range (n,-1,-1)]
给我 [5, 4, 3, 2, 1]
的准确结果,但是
def count(n):
for i in range (n,-1,-1):
return i
总是returnsn
.
第二个函数有什么问题?
def count(n):
return [i for i in range (n,-1,-1)]
给我 [5, 4, 3, 2, 1]
的准确结果,但是
def count(n):
for i in range (n,-1,-1):
return i
总是returnsn
.