5
我的代碼生成以下錯誤:TypeError: object() takes no parameters
類型錯誤:對象()不帶任何參數
class Graph(object):
def vertices(self):
return list(self.__graph_dict.keys())
if __name__ == "__main__":
g = { "a" : ["d"],
"b" : ["c"],
"c" : ["b", "c", "d", "e"],
"d" : ["a", "c"],
"e" : ["c"],
"f" : []
}
graph = Graph(g)
print("Vertices of graph:")
print(graph.vertices())
有沒有辦法可以解決這個問題?