擅长:python、mysql、java
<p>您的部分困惑可能是因为您命名了<code>ord()</code><code>AsciiArray</code>返回的<code>int</code>。它不是一个“数组”。在</p>
<p>使用列表理解很简单:</p>
<pre><code>word = 'COMPUTER'
print sum([ord(c) for c in word])
</code></pre>
<p>但是你要求具体步骤:</p>
^{pr2}$
<p>我要指出的是,通常情况下,常量使用大写名称,因此名称SUM通常不被认为是一种好的做法。在</p>