```
class Solution(object):
def levelOrder(self, root):
if root is None:
return []
queue=[]
queue.append(root)
result=[]
level=[]
while len(queue)>0:
check=len(queue)
for i in range(0,check):
tmp=queue.pop(0)
level.append([tmp.val])
if tmp.left is not None:
queue.append(tmp.left)
if tmp.right is not None:
queue.append(tmp.right)
result.append(level)
return result
```