Assign Person to Occupation

Published by Werdna in

You have two arrays. One shows the names of the people names, while the other shows their occupation jobs. Your task is to create a hash displaying each person to their respective occupation.

NamesJobs
AnnieTeacher
StevenEngineer
LisaDoctor
OsmanCashier

Example

names = ["Victor", "Paul", "Eddie"]
jobs = ["Vet", "Nurse", "Web Developer"]

assign_person_to_job(names, jobs) ➞ {
  "Victor" => "Vet",
  "Paul" => "Nurse",
  "Eddie" => "Web Developer"
}

Notes

  • The two arrays have the same length.
  • The index of a name in the names array is the same as the index of the person's job in the jobs array, as shown in the table above.
  • Check Resources for some useful information that can help with this challenge.
Watch a quick demo on how Edabit works.