擅长:python、mysql、java
<p>请注意,此解决方案使用<a href="https://www.python.org/dev/peps/pep-0289/" rel="nofollow noreferrer">Generator Expression</a>。你知道吗</p>
<pre><code>>>> sum(value/((1 + DiscountRate) ** period) for period, value in enumerate(cash, start=1))
50.1287
</code></pre>