Dec-16-2020, 10:56 PM
in my example i would like to return the whole list with it being in a function instead i am only getting 1 as a return.
However when its not in a function i will get the full list. So my question is how can i put this for loop in a function and have it return all the values if the function is called.
However when its not in a function i will get the full list. So my question is how can i put this for loop in a function and have it return all the values if the function is called.
def example(): list_1 = [1, 2, 3, 4, 5] for i in list_1: return i print(example())