/Luhn-Algorithm-Credit-Card-Validator

A simple Python implementation of the Luhn Algorithm for validating credit card numbers, completed as part of a FreeCodeCamp project.

Primary LanguagePython

Luhn Algorithm Credit Card Validator

A simple Python implementation of the Luhn Algorithm for validating credit card numbers, completed as part of a FreeCodeCamp project.

The Luhn Algorithm is widely used for error-checking in various applications, such as verifying credit card numbers. This project implements the Luhn Algorithm in Python, allowing users to validate credit card numbers easily.

Project Overview

By building this project, you'll gain experience working with numerical computations and string manipulation. The program reads a credit card number, processes it according to the Luhn Algorithm, and determines whether it is valid or invalid.

Features

  • Validates credit card numbers using the Luhn Algorithm
  • Handles card numbers formatted with spaces or dashes
  • Simple and easy-to-understand implementation

How to Use

  1. Clone this repository to your local machine.
  2. Run the main() function to test the credit card validation with the provided card number.
  3. Modify the card_number variable in the main() function to test other credit card numbers.

Example Usage

def main():
    card_number = '4111-1111-4555-1142'  # Example valid card number
    # Your code here

Requirements

  • Python 3.x

Acknowledgments

This project was completed as part of a FreeCodeCamp tutorial. Thank you to FreeCodeCamp for providing valuable learning resources!