This week's temperatures are in temps, one per day; at 28 degrees or more it's a beach day. Write BeachDays(temps) to return which days are beach days (the first day is 1), in order. No beach days gives an empty slice.
BeachDays([]int{25, 30, 28, 22})→[2, 3]BeachDays([]int{20, 21})→[]func BeachDays(temps []int) []intpackage main
func BeachDays(temps []int) []int {
days := []int{}
for i, t := range temps {
// your code here: hot enough? append the day number to days
}
return days
}
Run tries the examples. When they look right, Submit.