运行结果永远是type error,为啥呀
# Enter a code
def func(x):
if not isinstance(x,list) or not isinstance(x,tuple):
print('type error')
return None
if isinstance(x,list):
s = 0
for y in x:
if isinstance(y,int) or isinstance(y,float):
s = s + y
print(s)
return s
if isinstance(x,tuple):
s = 1
for y in x:
if isinstance(y,int) or isinstance(y,float):
s = s * y
print(s)
return s
L1 = [1,2,3,4,5,6,7,8,9,10]
L2 = (1,2,3,4,5,6,7,8,9,10)
L3 = 'kkk'
func(L1)