Skip to main content

Simple credit card validator using Luna algorithm

Project description

Credit Card Validator

This Python module provides a function to validate credit card numbers using the Luhn algorithm.

Installation

No installation is required. Simply copy the validator.py file into your project.

Usage

Import the validate function from the module and use it to check if a credit card number is valid.

Example

from validator import validatorLuhn

# Example credit card numbers
card_number1 = "4539 1488 0343 6467"  # Valid Visa card number
card_number2 = "8273 1232 7352 0569"  # Invalid card number

# Validate the card numbers
is_valid1 = validatorLuhn.validate(card_number1)
is_valid2 = validatorLuhn.validate(card_number2)

print(f"Card number {card_number1} is valid: {is_valid1}")
print(f"Card number {card_number2} is valid: {is_valid2}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

validator_luhn-0.1.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

validator_luhn-0.1.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page