From 27d6620361e12098b072ee0684a02e598b2d650b Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Sun, 5 May 2019 00:47:55 +0300 Subject: [PATCH] fix: map exercises --- 22-maps/exercises/01-warm-up/main.go | 2 +- 22-maps/exercises/01-warm-up/solution/main.go | 2 +- 22-maps/exercises/02-populate/main.go | 2 +- 22-maps/exercises/02-populate/solution/main.go | 8 +++----- 22-maps/exercises/03-students/solution/main.go | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/22-maps/exercises/01-warm-up/main.go b/22-maps/exercises/01-warm-up/main.go index 2521af6..9f0f344 100644 --- a/22-maps/exercises/01-warm-up/main.go +++ b/22-maps/exercises/01-warm-up/main.go @@ -21,7 +21,7 @@ func main() { // #1 // Key : Last name - // Element : Last name + // Element : Phone number // #2 // Key : Product ID diff --git a/22-maps/exercises/01-warm-up/solution/main.go b/22-maps/exercises/01-warm-up/solution/main.go index 861663f..f24cd13 100644 --- a/22-maps/exercises/01-warm-up/solution/main.go +++ b/22-maps/exercises/01-warm-up/solution/main.go @@ -13,7 +13,7 @@ func main() { var ( phones map[string]string // Key : Last name - // Element : Last name + // Element : Phone number // Key : Product ID // Element : Available / Unavailable diff --git a/22-maps/exercises/02-populate/main.go b/22-maps/exercises/02-populate/main.go index af37ef0..0ecb0d5 100644 --- a/22-maps/exercises/02-populate/main.go +++ b/22-maps/exercises/02-populate/main.go @@ -6,7 +6,7 @@ package main // Add elements to the maps that you've declared in the // first exercise, and try them by looking up for the keys. // -// Use map literals. +// Either use the `make()` or `map literals`. // // After completing the exercise, remove the data and check // that your program still works. diff --git a/22-maps/exercises/02-populate/solution/main.go b/22-maps/exercises/02-populate/solution/main.go index 3cdca0e..0bde61f 100644 --- a/22-maps/exercises/02-populate/solution/main.go +++ b/22-maps/exercises/02-populate/solution/main.go @@ -23,11 +23,9 @@ func main() { } multiPhones := map[string][]string{ - "bowen": []string{"202-555-0179"}, - "dulin": []string{ - "03.37.77.63.06", "03.37.70.50.05", "02.20.40.10.04", - }, - "greco": []string{"03489940240", "03489900120"}, + "bowen": {"202-555-0179"}, + "dulin": {"03.37.77.63.06", "03.37.70.50.05", "02.20.40.10.04"}, + "greco": {"03489940240", "03489900120"}, } basket := map[int]map[int]int{ diff --git a/22-maps/exercises/03-students/solution/main.go b/22-maps/exercises/03-students/solution/main.go index b26cffc..36b293c 100644 --- a/22-maps/exercises/03-students/solution/main.go +++ b/22-maps/exercises/03-students/solution/main.go @@ -22,7 +22,7 @@ func main() { "bobo": {"wizardry", "unwanted"}, } - // remove "bobo" house + // remove the "bobo" house delete(houses, "bobo") args := os.Args[1:]