I'm not sure if I understood the task correctly, but it's written: "add a key to every worker in the workers array called "season" and assign it the value "winter""
hash1 = {
:title => "MegaCorporation",
:location => "Europe",
:supervisors => [
{:name=>"Bill", :about=>"blah blah blah 1" },
{:name=>"John", :about=>"blah blah blah 2"},
{:name=>"Tiffany", :about=>"blah blah blah 3"}
],
:workers => [
{:name => "Alex", :level => "A"},
{:name=>"Anna", :level => "B"},
{:name => "Ashley", :level => "C"},
{:name => "Mike", :level => "B"}
]
}
So my code is:
hash1[:workers].each { |key,value| key["season"] = "winter"}
Did I do what I was asked correctly or what? :)
array1is not an array, it's a hash. Kind of a minor nitpick, but it could make your code slightly more understandable/readable.