换成tuple提示出现类型错误,求解答
代码长这样:
t=(1,2,3,4)
sum=0.0
for x in t:
sum=sum+t
#Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: unsupported operand type(s) for +:'float' and 'tuple'
print sum/4
#换成是sum=0则提示'int'and'tuple'
是for循环不能用在tuple吗