擅长:python、mysql、java
<p>您可以在input_1==0时退出,也可以将输入_1之后的所有内容包装在if中,以便仅在输入_1时执行!=0。在</p>
<pre><code>def main():
input_1 = 1
input_2 = 1
input_3 = 1
input_4 = 1
while input_1 !=0:
input_1 = int(input('Please enter a value or type 0 to end: '))
if input_1 != 0 :
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_1,input_1,input_1), end='')
def all_inputs(first,second,third,fourth):
sum = first + second + third + fourth
return(sum)
</code></pre>