I had checked it several times but it still says expected an indented block at if (root.right.left is not None) or (root.right.right is not None)
class Solution(object):
def sumOfLeftLeaves(self,root):
if root.val is None:
return 0
elif root.left is None and root.right is not None:
return self.sumOfLeftLeaves(root.right)
elif root.left is not None and root.right is None:
return self.sumOfLeftLeaves(root.left)
elif root.left is not None and root.right is not None:
if root.left.left is None and root.left.right is None:
if (root.right.left is not None) or (root.right.right is not None):
return root.left.val + self.sumOfLeftLeaves(root.right)
else:
return root.left.val
else:
return (self.sumOfLeftLeaves(root.left)+self.sumOfLeftLeaves(root.right))
else:
return 0
Help please.