18. using a list of lists in a function


#1

I wrote the code but the program throws an error at execution: ‘return’ outside function. If I start putting spaces (Tab), then the error changes to: line 9 return results
IndentationError: unexpected indent
What’s wrong?


#2

so this is currently your function + content:

def flatten(lists):
    results = []

the for loop isn’t part of the function content/body, why not?


#3

Thankэs it helped to solve the problem


#4

good, that was the intention :slight_smile: well done solving it with just a nudge in the right direction :slight_smile:


#5

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