擅长:python、mysql、java
<p>您应该在helper函数中执行var声明,该函数实际上没有返回任何内容:</p>
<pre><code>def sumOfLeftLeaves(num):
mytotal = 0
def helper(mytotal, num):
mytotal = mytotal + num
return mytotal
return helper(mytotal, num)
inum = 100
print(sumOfLeftLeaves(inum))
</code></pre>