Complete the code to create a hash with a symbol key.
person = { [1] => 'Alice' }In Ruby, symbol keys are written with a colon before the name, like :name.
Complete the code to access the value using a string key.
person = { 'name' => 'Bob' }
puts person[[1]]When the key is a string, you must use the exact string to access the value, including quotes.
Fix the error in accessing the hash value with a symbol key.
person = { name: 'Carol' }
puts person[[1]]The hash uses a symbol key :name, so you must use the symbol to access it.
Fill both blanks to create a hash with a string key and access its value.
data = { [1] => 42 }
puts data[[2]]The hash key is a string 'answer', so you must use the same string to access it.
Fill all three blanks to create a hash with symbol keys and print the value for :city.
location = { [1] => 'New York', [2] => 'USA' }
puts location[[3]]The hash uses symbol keys :city and :country. To print the city, use :city as the key.
