O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Silver Challenge

It is not uncommon to place instances of the Array type inside of a dictionary. Create a dictionary that represents a state. Your dictionary’s keys will refer to counties (to keep it short, only include three counties). Each key should map onto an array that holds five of the zip codes within that county. (You can make up the county names and zip codes.)

Finally, log only the dictionary’s zip codes. Your result should look something like the output below. Note that we are formatting the zip codes so that they do not overflow the page. Your zip codes may appear in a single line.

Georgia has the following zip codes: [30306, 30307, 30308, 30309, 30310, 30311, 30312, 30313, 30314, 30315, 30301, 30302, 30303, 30304, 30305] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required