fix: map exercises
This commit is contained in:
@ -21,7 +21,7 @@ func main() {
|
|||||||
|
|
||||||
// #1
|
// #1
|
||||||
// Key : Last name
|
// Key : Last name
|
||||||
// Element : Last name
|
// Element : Phone number
|
||||||
|
|
||||||
// #2
|
// #2
|
||||||
// Key : Product ID
|
// Key : Product ID
|
||||||
|
@ -13,7 +13,7 @@ func main() {
|
|||||||
var (
|
var (
|
||||||
phones map[string]string
|
phones map[string]string
|
||||||
// Key : Last name
|
// Key : Last name
|
||||||
// Element : Last name
|
// Element : Phone number
|
||||||
|
|
||||||
// Key : Product ID
|
// Key : Product ID
|
||||||
// Element : Available / Unavailable
|
// Element : Available / Unavailable
|
||||||
|
@ -6,7 +6,7 @@ package main
|
|||||||
// Add elements to the maps that you've declared in the
|
// Add elements to the maps that you've declared in the
|
||||||
// first exercise, and try them by looking up for the keys.
|
// 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
|
// After completing the exercise, remove the data and check
|
||||||
// that your program still works.
|
// that your program still works.
|
||||||
|
@ -23,11 +23,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
multiPhones := map[string][]string{
|
multiPhones := map[string][]string{
|
||||||
"bowen": []string{"202-555-0179"},
|
"bowen": {"202-555-0179"},
|
||||||
"dulin": []string{
|
"dulin": {"03.37.77.63.06", "03.37.70.50.05", "02.20.40.10.04"},
|
||||||
"03.37.77.63.06", "03.37.70.50.05", "02.20.40.10.04",
|
"greco": {"03489940240", "03489900120"},
|
||||||
},
|
|
||||||
"greco": []string{"03489940240", "03489900120"},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
basket := map[int]map[int]int{
|
basket := map[int]map[int]int{
|
||||||
|
@ -22,7 +22,7 @@ func main() {
|
|||||||
"bobo": {"wizardry", "unwanted"},
|
"bobo": {"wizardry", "unwanted"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove "bobo" house
|
// remove the "bobo" house
|
||||||
delete(houses, "bobo")
|
delete(houses, "bobo")
|
||||||
|
|
||||||
args := os.Args[1:]
|
args := os.Args[1:]
|
||||||
|
Reference in New Issue
Block a user