0
don't run
def fun(s,*a): for i in a: s=i+s return s a1=[] n=0 while 1: a1.append(input('Please enter number:')) n=n+1 if ''==a1[n-1]: break print( fun(0,*a1) )
2 Respostas
+ 2
Here's a working version. Feel free to ask if you don't understand any of the changes I made.
def fun(s, a):
for i in a:
s += i
return s
a1=[]
n=0
while 1:
x = input('Please enter number:')
if x != '':
a1.append(int(x))
else:
break
print(fun(0, a1))
0
I'm a beginner of pythen, thank you for your advice