<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Enhance the following code to find the average of all the even numbers in the array:
my_array = [1,2,3,4,5,6]<|im_end|>
<|im_start|>assistant
even_numbers = []
for number in my_array:
    if number % 2 == 0:
        even_numbers.append(number)

average = sum(even_numbers) / len(even_numbers)
print(average)<|im_end|>
