Complete the code to declare a package named "mathutils".
package [1]The package keyword declares the package name. Here, it should be mathutils to create a custom package named "mathutils".
Complete the code to import the "fmt" package for printing.
import [1]
The import statement includes external packages. To print output, you import "fmt".
Fix the error in the function declaration to make it exported from the package.
func [1](a int, b int) int { return a + b }
In Go, to export a function from a package, its name must start with a capital letter. So Add is exported, while add is not.
Fill both blanks to create a map of word lengths for words longer than 3 characters.
lengths := map[string]int{
[1]: [2],
}
for _, word := range []string{"go", "code", "fun", "package"} {
if len(word) > 3 {
lengths[word] = len(word)
}
}The map key should be a string like "code", and the value should be 4, the length of "code".
Fill all three blanks to create a function that returns a map of uppercase words and their lengths for words longer than 3 characters.
func [1](words []string) map[string]int { result := make(map[string]int) for _, [2] := range words { if len([2]) > 3 { result[strings.ToUpper([2])] = len([2]) } } return result }
The function name is WordLengths. The loop variable is w, used consistently to check length and convert to uppercase.