A classifier of payment cards BIN numbers (training exercise).
"Payment card numbers are composed of 8 to 19 digits. The leading six or eight digits are the issuer identification number (IIN) sometimes referred to as the bank identification number (BIN)" - Wikipedia.
Write a program that that given a list of BIN ranges and card issuers, and an input card number, returns the correspoding card issuer.
Input BIN range object:
ranges = [["4444 4444 11", "4444 4444 44", "Visa credit"], ["4500 0000 55", "4999 9999 00", "Visa debit"], ["4999 9999 99", "5555 0000 00", "Master credit"], ["6666 4444 11", "7777 0000 00", "Amex"]];
cardNumber = "4733 6109 7901 2139";
Output:
"Visa debit"