Slices, maps and strings
Lists with arrays and slices, key and value pairs with maps, and text with strings and runes.
About 4 hours of study
Learning objectives
- Build and change slices
- Count and group with maps
- Work with text correctly
Lessons
- 1
Arrays and slices
Fixed-size arrays, growable slices, append, len, make, slicing with a[low:high], range, copy, sorting with sort.Ints and slices of slices.
- 2
Maps
Storing key and value pairs with maps: creating, adding, reading with the comma ok form, deleting, counting, maps of slices, and printing in a fixed order by sorting the keys.
- 3
Strings, runes and the strings package
How Go stores text as bytes, the difference between bytes and runes, indexing and slicing strings, looping with range, and the useful functions of the strings package.
Module practice
- Go: Reverse a listEasy
- Go: Remove duplicatesMedium
- Go: Spiral orderHard
- Go: Count the votesEasy
- Go: Find a pair with a given sumMedium
- Go: Group the anagramsHard
- Go: Palindrome checkEasy
- Go: Word frequencyMedium
- Go: Caesar cipherHard
Module quiz
‹ Control flow and functionsStructs, methods and interfaces ›