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) )

18th Oct 2018, 4:48 AM
王明
王明 - avatar
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))
18th Oct 2018, 5:02 AM
Anna
Anna - avatar
0
I'm a beginner of pythen, thank you for your advice
18th Oct 2018, 5:28 AM
王明
王明 - avatar