amrha / CodingChallenge

BankruptcyWatch Coding Challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BankruptcyWatch Coding Challenge

Goal

The BankruptcyWatch Coding Challenge is designed to help us locate experienced developers who are proficient in the Python language and standard libraries and in developing at Github and who are able to write clean, correct, and reliable code.

The Challenge

The directory input contains three files each containing a list of US names and addresses:

The file formats are not documented, but you can deduce the formats by examing their contents. The challenge is to write a python script challenge.py, desgined to be run from the command line, that accepts a list of pathnames of files in any of the above formats, parses them, and writes a JSON-encoded list of the combined addresses to standard output, sorted by ZIP code. You can assume that the the format of each file corresponds to its extension, as illustrated by the above examples. The output should be a pretty-printed JSON array of JSON objects, each having 5 or 6 properties, serialized in the given order:

  • name: The person's full name, if present, consisting of a list of one or more given names followed by the family name
  • organization: The company or organization name, if present
  • street: The street address, often just a house number followed by a direction indicator and a street name
  • city: The city name
  • county: The county name, if present
  • state: The US state name or abbreviation
  • zip: The ZIP code or ZIP+4, in the format 00000 or 00000-0000

A personal name or organization name will always be present, but not both.

Here is a sample output:

[
  {
    "name": "Hilda Flores",
    "street": "1509 Alberbrook Pl",
    "city": "Garland",
    "county": "DALLAS",
    "state": "TX",
    "zip": "75040"
  },
  {
    "company": "Central Trading Company Ltd.",
    "street": "1501 North Division Street",
    "city": "Plainfield",
    "state": "Illinois",
    "zip": "60544-3890"
  }
]

The script should

  • Be well-organized and easy to understand
  • Use only standard Python libraries
  • Be compatible with Python 3.11
  • Conform to PEP 8
  • Provide a --help option
  • Check for errors in the argument list
  • Check for errors in the input files that prevent them from being parsed
  • Output a list of addresses only if there are no errors in the input
  • Write any error messages to stderr
  • Exit with status 0 or 1 to indicate success or failure

Timing

You should submit your solution within 24 hours of beginning to work on the challenge.

Submitting Your Solution

To Submit your solution, fork this repository and submit a pull request. It should consist of a single commit with a concise commit message.


Copyright © 2024 BankruptcyWatch, LLC

About

BankruptcyWatch Coding Challenge


Languages

Language:Python 100.0%