擅长:python、mysql、java
<p>你需要做的是:</p>
<pre><code>money=map(float,input().split()) #could have use int as well if input was a sequence of integers
total=sum(money)
print("Total:",total)
</code></pre>
<p>你也可以这样做:</p>
^{pr2}$
<p>在python中,输入默认为字符串,您需要对其进行类型转换</p>
<pre><code>int(input("enter the expenses should work: "))
</code></pre>
<p>或者是浮动的</p>
<pre><code>float(input("enter the expenses should work: "))
</code></pre>
<p>一般来说,你所需要的就是排版或者如果你的输入是一个数字列表的话</p>
<pre><code>map(int,input().split()) #can use float here as well
</code></pre>
<p>在python2.x中,map将创建一个列表,而在python3.x中,map将创建生成器。在</p>