Exercise 3: Flip the Keys and Values
Flip the keys and values of a dictionary.
We'll cover the following
Problem statement
There’s a method on hashes that flips keys and values. Find that method in the Ruby Hash
documentation and try to flip the keys and values of this hash.
Example
input_hash = {
:one => 'uno',
:two => 'dos',
:three => 'tres'
}
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy