请问这样为什么不对?
def average(*args):
for x in args:
if len(args)==0:
a==0.0
return a
else:
L=[]
L.insert=(x)
n=len(L)
s=sum(L)
a=s/n
return a
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
for x in args:
if len(args)==0:
a==0.0
return a
else:
L=[]
L.insert=(x)
n=len(L)
s=sum(L)
a=s/n
return a
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2017-07-14
举报