Exercise 1: Composite Data Types
Explore exercises that enhance your understanding of composite data types in Go, including converting between arrays, maps, and slices, and modifying programs to handle multiple command-line arguments. Gain practical skills through targeted coding problems to reinforce your Go proficiency.
Let’s practice what we’ve learned so far in the following exercises. Solutions to these exercises will be provided in the next lesson.
Problem 1
Write a Go program that converts an existing array into a map. For example, let’s assume if we define a 2D array as arr := [][]string{{"key1", "value1"}, {"key2", "value2"}, {"key3", ...