Skip to content


Calculate the second lowest cost silver plan


You've been asked to determine the second lowest cost silver plan (SLCSP) for a group of ZIP codes.


You've been given a CSV file, slcsp.csv, which contains the ZIP codes in the first column. Fill in the second column with the rate (see below) of the corresponding SLCSP and emit the answer on stdout using the same CSV format as the input. Write your code in your best programming language.

Expected output

The order of the rows in your answer as emitted on stdout must stay the same as how they appeared in the original slcsp.csv. The first row should be the column headers: zipcode,rate The remaining lines should output unquoted values with two digits after the decimal place of the rates, for example: 64148,245.20.

It may not be possible to determine a SLCSP for every ZIP code given; for example, if there is only one silver plan available, there is no second lowest cost plan. Check for cases where a definitive answer cannot be found and leave those cells blank in the output (no quotes or zeroes or other text). For example, 40813,.

Additional information

The SLCSP is the so-called "benchmark" health plan in a particular area. It's used to compute the tax credit that qualifying individuals and families receive on the marketplace. It's the second lowest rate for a silver plan in the rate area.

For example, if a rate area had silver plans with rates of [197.3, 197.3, 201.1, 305.4, 306.7, 411.24], the SLCSP for that rate area would be 201.1, since it's the second lowest rate in that rate area.

A plan has a "metal level", which can be either Bronze, Silver, Gold, Platinum, or Catastrophic. The metal level is indicative of the level of coverage the plan provides.

A plan has a "rate", which is the amount that a consumer pays as a monthly premium, in dollars.

A plan has a "rate area", which is a geographic region in a state that determines the plan's rate. A rate area is a tuple of a state and a number, for example, NY 1, IL 14.

There are two additional CSV files in this directory besides slcsp.csv:

  • plans.csv — all the health plans in the U.S. on the marketplace
  • zips.csv — a mapping of ZIP code to county/counties & rate area(s)

A ZIP code can potentially be in more than one county. If the county can not be determined definitively by the ZIP code, it may still be possible to determine the rate area for that ZIP code. A ZIP code can also be in more than one rate area. In that case, the answer is ambiguous and should be left blank.

We'll want to compile your code from source and run it from a Unix-like command line, so please include the complete instructions for doing so in a COMMENTS file.

Included files

Here are the files we'll give to you to get you started. Download them when you are ready to begin.

Ready to submit?

Don't include anything in your files that could identify you. We assign submissions a random number when they are received so our team does not know whose homework they are evaluating. Multiple team members will review your submission before a decision is made.

Submit homework