A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-114.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6m:=map[string][]int{}
7m["a"]=append(m["a"],7)
8fmt.Println(m["a"])
9}
Maps
Answer & explanation
Console output
[7]
Why
Reading the absent key "a" returns the zero value of []int, which is a nil slice. append works on a nil slice, producing a one-element slice [7], which is then stored back. This is the standard append-to-map-of-slices pattern that needs no pre-initialization.