Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

27 lines
397 B

package main
import "fmt"
func main() {
words := map[string]int{
"Gonna": 3,
"You": 3,
"Give": 2,
"Never": 1,
"Up": 4,
}
max_word := ""
max_count := 0
for word, count := range words {
if count > max_count {
max_word, max_count = word, count
}
}
fmt.Println("Most popular word:", max_word)
fmt.Println("With a count of:", max_count)
}