Question: what is causing the error and how can I remove it. error:Cannot assign member left for type Node Expression of type Node cannot be assigned
what is causing the error and how can I remove it.
error:Cannot assign member "left" for type "Node" Expression of type "Node" cannot be assigned to member "left" of class "Node" Type cannot be assigned to type "None"
code:
class Node(object):
def __init__(self,value):
self.left = None
self.right = None
self.value = value
class binary_tree(object):
def __init__(self,root):
self.root = Node(root)
my_tree = binary_tree(10)
my_tree.root.left = Node(12)
my_tree.root.right = Node(8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
