Skip to content Skip to sidebar Skip to footer

Typeerror: Object() Takes No Parameters

My code generates the following error: TypeError: object() takes no parameters class Graph(object): def vertices(self): return list(self.__graph_dict.keys()) if __name

Solution 1:

Your Graph class takes no arguments on __init__ therefore when you call:

graph = Graph(g)

You get an error because Graph doesn't know what to do with 'g'. I think what you may want is:

classGraph(object):    def__init__(self, values):
        self.__graph_dict = values
    defvertices(self):
        return list(self.__graph_dict.keys())

Post a Comment for "Typeerror: Object() Takes No Parameters"