为什么我只会输出'error'和None
def func(l):
if not isinstance(l,list) or not isinstance(l,tuple):
print ('error')
return None
elif isinstance(l,list):
sum = 0
for item in l:
if isinstance(item,int) or isinstance(item,float):
sum += item
return sum
elif isinstance(l,tuple):
sum = 1
for item in l:
if isinstance(item,int) or isinstance(item,float):
sum = sum * item
return sum
return None