Complete the code to return the sum of two integers.
func add(a int, b int) int {
return a [1] b
}The function should return the sum of a and b. The + operator adds two numbers.
Complete the code to return the length of a string.
func length(s string) int {
return [1](s)
}size or count.The built-in len function returns the length of a string in Go.
Fix the error in the function to return the product of two floats.
func multiply(x float64, y float64) float64 {
return x [1] y
}The function should return the product, so the multiplication operator * is needed.
Fill both blanks to return a map with words as keys and their lengths as values, only for words longer than 3 characters.
func wordLengths(words []string) map[string]int {
lengths := make(map[string]int)
for _, word := range words {
if [1](word) [2] 3 {
lengths[word] = [1](word)
}
}
return lengths
}cap instead of len.< instead of >.len as a function.The function uses len(word) to get the length of each word and checks if it is greater than 3 using >.
Fill all three blanks to return a new map with uppercase keys and values only for entries with values greater than 10.
func filterAndUppercase(data map[string]int) map[string]int {
result := make(map[string]int)
for [1], [2] := range data {
if [2] [3] 10 {
result[strings.ToUpper([1])] = [2]
}
}
return result
}ToUpper as a function.The loop uses k and v for key and value. It checks if v > 10 and adds the uppercase key using strings.ToUpper().