pathon问题,在线求解
毕业设计
1
#!/usr/bin/python
class Vector:
def init(self,a,b):
self.a = a
self.b = b
def init(self):
return 'Vector (%d,%d)' % (self.a,self.b)
def add(self,other):
return Vector(self.a + other.a, self.b+other.b)
v1 = Vector(1,2)
v2 = Vector(3,4)
print(v1+v2)
运行结果:
root@kali:~/Desktop# python t2.py
Traceback (most recent call last):
File "t2.py", line 13, in
v1 = Vector(1,2)
TypeError: init () takes 1 positional argument but 3 were given
大家帮看看问题在哪儿
发表回复