Hello,
IĄ­m a girl form Germany and I need your help.
I have to do a task for university and IĄ­m trying for hours, but it
never works :/. Maybe you can help me. I would be so happy!

The task is to make a function called "mean(a)", for this function we
take a array we can build by ourselves, for example a = [1,4,5,7]. So
this function should summ up the elements of the array (for example 1 +
4 + 5 + 7] and then divide this sum with the count of the members (in
this example 4) --> sum/count --> also called mean. The function should
return the mean. So far i got it. But then we also should be prepared
for the case that there are no elements in the array then the function
should return "0". But thatĄ­s what I donĄ­t understand. We must do it all
with a loop. And I donĄ­t understand this. The result should also be a
floating-point number.

This is what I got so far:

 a = [1,2,3,4,]


def mean(a)
count = 0
summe = 0

for x in a
   count += 1
   summe += x
end

mean=(summe/count)

return mean

end

puts "#{mean(a)}"


Would be so nice to help me.

Thank you :)