我的输出有问题
class Fib(object):
def __init__(self, num):
a = 0
b = 1
l = []
for n in range(num):
l.append(a)
a,b = b,a+b #这一段有问题
self.numbers = l
def __str__(self):
return str(self.numbers)
__repr__ = __str__
def __len__(self):
return len(self.numbers)
f = Fib(10)
print (f)
print (len(f))
如果我用a,b = b,a+b就输出正常,但是我用
a = b
b = a+b
输出就不对