The cinema splits the queue by age: under 12 buys a child ticket, everyone else an adult one. Write SplitAges(ages) to return two slices, the children's ages and the adults' ages, each in the original order. Nobody gives two empty slices.
SplitAges([]int{8, 35, 11, 40})→([8, 11], [35, 40])SplitAges([]int{})→([], [])func SplitAges(ages []int) ([]int, []int)package main
func SplitAges(ages []int) ([]int, []int) {
kids := []int{}
adults := []int{}
// your code here: go through the ages: under 12 into kids, the rest into adults
return kids, adults
}
Run tries the examples. When they look right, Submit.