Can any one tell me what is wrong in my code


n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]

def flatten(lists):
    results=[ ]
    for numbers in lists:
        for n1 in numbers:
    return results                    
print flatten(n)

it is giving error :AttributeError: 'list' object has no attribute 'apppend'


You must have only one loop, where you loop over the parameter lists. Reason for looping over the parameter is that it makes possible to use your function in different lists.


please can you explain?? i am not getting it


So you updated your code? Good. But now you have a typo in the line number #8.



thanku so much :slight_smile: work it


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