Kodewick
Start learning →
Starter←→0 / 70

Nut warning

#032StarterStringsConditions2 min

The bakery puts a warning on anything with nuts. The ingredients are in recipe (all lower case). Write HasNuts(recipe): return true if it contains "nut" (as in walnut or peanut), false if not.

Examples
HasNuts("flour, walnuts, sugar")→True
HasNuts("rice, egg")→False
The functionfunc HasNuts(recipe string) bool
main.go
package main

import "strings"

func HasNuts(recipe string) bool {
	// your code here: recipe contains "nut"? return true
	return false
}
Ctrl + Enter runs too
Result

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