I need some help with fixing a bug in my program. I can't post the entire code here as its an on going assignment.
I'm building a Tree in Python.
class Tree: def __init__(self, f, r): self.first = f self.rest = r
This is my Tree.
I perform a depth-first search on it.
So I call
The traverse function looks like this:
def traverse(vertex): if len(vertex) == 0: return ...
The following is the error that keeps poping out:
if len(vertex) == 0:
AttributeError: Tree instance has no attribute '__len__'
Can someone help me with this.