Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

RUBY! pigeon_data = { :color => { :purple => [Theo, Peter Jr., Lucky], :grey => [Theo, Peter Jr., Ms. K], :white => [Queenie, Andrew, Ms.

RUBY!
  1. pigeon_data = {
  2. :color => {
  3. :purple => ["Theo", "Peter Jr.", "Lucky"],
  4. :grey => ["Theo", "Peter Jr.", "Ms. K"],
  5. :white => ["Queenie", "Andrew", "Ms. K", "Alex"],
  6. :brown => ["Queenie", "Alex"]
  7. },
  8. :gender => {
  9. :male => ["Alex", "Theo", "Peter Jr.", "Andrew", "Lucky"],
  10. :female => ["Queenie", "Ms. K"]
  11. },
  12. :lives => {
  13. "Subway" => ["Theo", "Queenie"],
  14. "Central Park" => ["Alex", "Ms. K", "Lucky"],
  15. "Library" => ["Peter Jr."],
  16. "City Hall" => ["Andrew"]
  17. }
  18. }

The data above is organized by attributes - :color, :gender, and :lives, each a hash. Within these hashes are arrays of pigeon names.

We want this data, but in a different structure. Rather than sorting by attributes, your task is to create a hash where pigeon names are the keys, with each name pointing to a hash of their attributes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

5. Why does proof of transfer evidence matter?

Answered: 1 week ago

Question

Understanding Groups

Answered: 1 week ago