Shouldn’t the code below print : result: [ 2 ,4, 6 ] in charcoal ??
I’m having trouble understanding where return statements and functions return to in python ?
When they say return statements and functions return to the ’ calling code’, that means
to the calling function outside of the actual function ? No one ever explains this very well.
However, I do understand that if you assign the function to a variable, the function will
return the result to this variable.
def get_even(numbers): even_nums = [num for num in numbers if not num % 2] return even_nums get_even([1, 2, 3, 4, 5, 6])
Also can someone tell me why when I hit ‘post’ my formatting goes away ?