'results' returning NONE


so im basically trying to flatten **n** into a single list **results** containing all elements in order , everytime I run this code , it returns **None** . 

n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]
# Add your function here
def flatten(lists):
    for numbers in lists:
        for number in numbers: #iterate through loop variable
            return results

print flatten(n)


a function ends the moment a return keyword is reached

so your function ends pretty early (after only appending one number to results), because the return keyword is reached (function ends) the remaining iterations of the loop are never executed


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.