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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!