<p>我在课堂上做实验,遇到了这个问题:</p>
<p><strong>编写一个程序,使用for语句作为计数循环,将用户输入的整数相加。首先程序询问要加多少个数字。然后程序提示用户输入每个数字。最后打印总和。</strong></p>
<p>我很难回答这个问题,如果有人能帮我那就太好了,谢谢!你知道吗</p>
<p>到目前为止,我已经写了:</p>
<pre><code> NumOfInt=int(raw_input("How many numbers would you like to add up?"))
for i in range(NumOfInt):
</code></pre>
<pre><code>number = int(raw_input("How many numbers?"))
tot = 0
for x in range(number):
tot += int(raw_input("Enter next number:"))
print tot
</code></pre>