I'm having some unexpected results with trying to iterate through a list of lists using a function.
A = [[1,2,3],
[4,5,6]]
def list_of_lists(l):
for i in l:
return i
print list_of_lists(A)
Out : [1, 2, 3]
A = [[1,2,3],
[4,5,6]]
def list_of_lists(l):
for i in l:
print i
print list_of_lists(A)
Out : [1, 2, 3]
[4, 5, 6]
None
Why does it seem like I'm only returning the first element of A when my function uses return?