Kodewick
Start learning →
Starter←→0 / 70

Long walks

#021StarterLoops3 min

Every dog walk this week is in minutes. Write LongWalks(minutes): a walk of 30 minutes or more is a long walk; return how many there were. An empty slice gives 0.

Examples
LongWalks([]int{20, 45, 30})→2
LongWalks([]int{})→0
The functionfunc LongWalks(minutes []int) int
main.go
package main

func LongWalks(minutes []int) int {
	count := 0
	for _, m := range minutes {
		// your code here: 30 minutes or more? add 1 to count
	}
	return count
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.