I need help - Lists and Python
2 answers
As Andrey pointed out, you will get better answers if you show us the code you are currently using. Also if you could indicate which version of Python you are using, that would be great.
There are several ways to get the list back. Let's say for example we have a function called retlist.
def retlist():
return []
will return an empty list
def retlist():
a = list()
a.append(5)
return a
will return [5].
You can also use a list comprehension to return a list
def retlist():
return [x*x for x in range(10)]
There are many ways to return a list. But mostly it has to do with returns.
If you are after a more detailed answer, please comment what you need.
Luck
+2
source to share