Generation

generate functionSat, 12 Nov 2022

return the average of an array of integers

func average(xs []float64) float64 { total := 0.0 for _, v := range xs { total += v } return total / float64(len(xs)) }

Questions about programming?Chat with your personal AI assistant