这两有什么区别呢?
def average(*args):
sum = 0
if len(args) == 0:
return sum
for item in args:
sum += item
avg = sum / len(args)
return avg
里面的sum+=item跟sum=sum+item有什么区别呢?
def average(*args):
sum = 0
if len(args) == 0:
return sum
for item in args:
sum += item
avg = sum / len(args)
return avg
里面的sum+=item跟sum=sum+item有什么区别呢?
2024-03-19
举报