I’m confused about this lesson, or more specifically the use of
return. The example given does not use
return but still prints the updated list. When I remove
return from the code in the editor and run the code, “None” appears in the console. If the premise is the same, modifying an element of a list in a function, why is
return needed in the code I am updating?
def list_function(x): x = x + 3 return x n = [3, 5, 7] print list_function(n) print def double_first(n): n = n * 2 numbers = [1, 2, 3, 4] double_first(numbers) print numbers