Building a Country File Parser in Ruby
This guide will show you how to build a method that can analyze a text file concerning countries and return the information required.
Guide Tasks
  • Read Tutorial
  • Complete the Exercise

Summary

Build a method that parses a file and returns data about a country.

Exercise Description

For this coding exercise, you should be able to define a method that can pull out the country code and first abbreviation from a raw text file of country information.

Example Data

(['93', 'AF'])
(['263', 'ZW'])

Real World Usage

If you are given a file with a lot of information, in this case about countries, this exercise helps you understand how fast it can be to implement a method that can retrieve specific code about each country, without all the excess data.

Test Cases

Code File