I want to get this function to work:
def getEvenNumbers (numbers):
bo = []
for num in numbers:
bo.append(num)
if num % 2 == 0:
return bo
getEvenNumbers([1, 4, 8, 9]) returns [4] though.
I expect more result like [4,8] but it not working, I only get [4]? what am I doing wrong?
You are returning as soon as one of the numbers is found to be even.
Or: