Follow is my code:

```
class Solution:
# @param root, a tree node
# @return a list of integers
def preorderTraversal(self, root,result=[]):
if root==None:
return result
else:
result.append(root.val)
Solution.preorderTraversal(self,root.left,result)
Solution.preorderTraversal(self,root.right,result)
return result
```

On OJ,when run with {1,2},it will return [1,1,2].

But it can work out with the right answer([1,2]) on my computer.

Can anyone tell me why?