class vector:
'基于数值的运算的类'
def _init_(self,a,b):
self.a = a
self.b = b
def _add_(self,other):
return vector(self.a + other.a,self.b + other.b)
v1 = vector(2,4)
v2 = vector(3,5)
print(v2._add_(v1))
解决方法:init()不对,是__init__(),2个下划线哈