Menu
Coddy logo textTech

Slice to Map

Lesson 14 of 24 in Coddy's Golang Challenges - Level 1 course.

challenge icon

Challenge

Easy

Write a function that takes a slice and returns a map where the key is the string and its length as a value.

Example:

Input: []string{"Coddy", "LearnGolang", "LearnPython", "Challenges"}

Output: map[Challenges:10 Coddy:5 LearnGolang:11 LearnPython:11]

 

Try it yourself

func slicetoMap() {

}

All lessons in Golang Challenges - Level 1