Back to Freecodecamp

Step 2

curriculum/challenges/english/blocks/learn-tree-traversal-by-building-a-binary-search-tree/65c4ef8463f869d0eaf87c67.md

latest867 B
Original Source

--description--

Inside the TreeNode class, replace pass with an __init__ method so that you can initialize the attributes of the object. Don't add any parameters for now.

--hints--

You should remove pass keyword from the TreeNode class and move it inside the __init__ method.

js
({
  test: () => {
    const pyClassStr = runPython(`str(_Node(_code).find_class("TreeNode"))`);
    const to_test = pyClassStr.split("\n");
    assert.notInclude(to_test[1], "pass");
  },
});

You should define an __init__ method inside your TreeNode class. Remember to use the pass keyword inside.

js
({
  test: () => {
    assert(
      runPython(`_Node(_code).find_class("TreeNode").has_function("__init__")`)
    );
  },
});

--seed--

--seed-contents--

py
--fcc-editable-region--
class TreeNode:
    pass
--fcc-editable-region--