擅长:python、mysql、java
<p>我不是一个Python用户,但我知道你的问题在哪里。在</p>
<p>输入1、2、3和4的预设值在循环内完成。在</p>
<p>为什么不把输入_1放在循环外,而放在循环内呢。这样一来,只要你运行函数,它就会通过while look check if input_1!=0,如果是,循环将立即终止。在</p>
<p>事实上,既然已经用四个独立的变量收集了4个参数,为什么还需要一个循环呢。你可以这么做</p>
<pre><code>def main:
input_1 = int(input('Please enter first value: '))
input_2 = int(input('Please enter a second value: '))
input_3 = int(input('Please enter a third value: '))
input_4 = int(input('Please enter a fourth value: '))
print('The total amount is: ', end='')
print(all_inputs(input_1,input_2,input_3,input_4), end='')
def all_inputs(first,second,third,fourth):
sum = first + second + third + fourth
return(sum)
main()
</code></pre>