Complete the code to declare a map that stores string keys and int values.
var scores map[string][1]string as the value type instead of int.The map stores string keys and integer values, so the value type is int.
Complete the code to initialize the map before adding elements.
scores := make(map[string][1])string or other types instead of int.The map values are integers, so make must specify int as the value type.
Fix the error in the code that adds a new key-value pair to the map.
scores[[1]] = 90
Map keys of type string must be enclosed in double quotes when used as literals.
Fill both blanks to check if a key exists in the map and print its value.
value, [1] := scores["Bob"] if [2] { fmt.Println("Bob's score:", value) }
The idiomatic way in Go to check if a key exists is to use the second value, often named ok, which is a boolean.
Fill all three blanks to declare the words slice, initialize the lengths map, and populate it with lengths for words longer than 3 characters.
[1] := []string{"go", "code", "map", "function"} [2] := make(map[string][3]) for _, w := range [1] { if len(w) > 3 { [2][w] = len(w) } }
string instead of int for map values.BLANK_1 declares the words slice, BLANK_2 the lengths map variable, and BLANK_3 the int value type for storing lengths.