shufler()只取1个位置参数(给定2个)

zoe*_*oe 4 python python-3.x

以下是我的代码.

def __init__(self):
    self.node=[]
    self.fronts=[]
    self.GoalNode=['1','2','3','4','5','6','7','8','0']
    self.StartNode=['1','2','3','4','5','6','7','8','0']
    self.PreviousNode=[]
    self.prePreviousNode=[]
    self.PreviousCount=1

def Solve(self):
    self.shufler(10)
    ......


def shufler(self):

        while True:
            node=self.StartNode
Run Code Online (Sandbox Code Playgroud)

以下是我收到的错误消息:

File "E:\Zoe's file\CMPT 310\Assign 2\astart8puzzle\AI8puzzle\py8puzzel.py", line 18, in Solve
    self.shufler(10)
TypeError: shufler() takes exactly 1 positional argument (2 given)
Run Code Online (Sandbox Code Playgroud)

我不明白我在哪里提出两个论点.

Joh*_*ica 8

self.shufler(10)
Run Code Online (Sandbox Code Playgroud)

shufler用两个参数调用,(1)self和(2)10.它左边的对象.用作第一个参数.

要处理10参数,请在shufler定义中添加第二个参数:

def shufler(self, count):
Run Code Online (Sandbox Code Playgroud)