Guest User

Untitled

a guest
Feb 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. class TreeNode(object):
  2. def __init__(self, x):
  3. self.val = x
  4. self.left = None
  5. self.right = None
  6.  
  7.  
  8.  
  9. T= TreeNode(5)
  10. T.left = TreeNode(2)
  11. T.right = TreeNode(7)
  12.  
  13. ans = T and T.left #===> This returns T.left, <--------- how?
  14. ans2 = T or T.left #===> This returns T . <-------------?
Add Comment
Please, Sign In to add comment