Skip to content

kamauwashington/python-luhn-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Luhn (Mod 10) Algorithm in Python 3+

This repository is purely for reference and is illustrative in it is purpose. This is one of the many ways of implementing this algorithm.

This project illustrates an implementation of the Luhn Algorithm in Python. The Luhn Algorithm is the standard method of validating a credit card number prior to authorization. It is also an interesting algorithm as it teaches a lot of the basics and nuances of a language through implementation.

Prerequisites

Before you continue, ensure you have met the following requirements:

  • Python 3 installed
  • PyTest installed (to run the unit tests if need be)

Testing

  • Issue from the command line pytest

Notes

  • This repository is heavily commented to provide context as to what and why, if in VS Code feel free to collapse all comments if they are obtrusive
    • On Mac -> Press + K then + /
    • On Windows & Linux -> Press Ctrl + K then Ctrl + /
  • The checkdigits validated are from various sites across the web, there will be more added and augmentation of the algorithm when edge cases are found.