With specified country name or names, get the associated capital
Examples
# view the searchable countries, return first 6
head(names(capitalOf))
#> [1] "afghanistan" "albania" "algeria"
#> [4] "andorra" "angola" "antigua and barbuda"
#task 0: check if the capital of japan is included
#should be all in lower case
grep("japan",names(capitalOf), value = TRUE)
#> [1] "japan"
#task 1: check the capital of nigeria
capitalOf$nigeria
#> [1] "Abuja"
#task 2: check the capital of united states
capitalOf$`united states`
#> [1] "Washington, D.C"
#task 3: check capital of multiple countries
capitalOf[c("slovenia","romania","malaysia")]
#> $slovenia
#> [1] "Ljubljana"
#>
#> $romania
#> [1] "Bucharest"
#>
#> $malaysia
#> [1] "Kuala Lumpur"
#>
#task 4: what if the capital is not available
capitalOf[c("randomcountry","mexico","luxembourg")]
#> $<NA>
#> NULL
#>
#> $mexico
#> [1] "Mexico City"
#>
#> $luxembourg
#> [1] "Luxembourg City"
#>