Complete the code to define the constructor method for a binary tree node.
class Node: def __init__(self, value): self.value = value self.left = None self.[1] = None
The right child of a binary tree node is stored in self.right. This completes the node structure with left and right pointers.
Complete the code to create a new node with value 10.
root = Node([1])The value passed to the node constructor should be an integer 10, not a string or other type.
Fix the error in the code to assign a left child node to root.
root.left = Node([1])The left child node should be created with a value like 5, not with root or None.
Fill both blanks to check if a node has no children (is a leaf).
def is_leaf(node): return node.left is [1] and node.[2] is None
A leaf node has both left and right children as None. So we check if node.left is None and node.right is None.
Fill all three blanks to create a node, assign left and right children with values 1 and 2.
root = Node([1]) root.left = Node([2]) root.[3] = Node(2)
The root node is created with value 0, left child with 1, and right child assigned using root.right.
