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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file validator_luhn-0.1.1.tar.gz.

File metadata

  • Download URL: validator_luhn-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for validator_luhn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ab35b82fa1b3b96924b0627391ab0746323414ce491d7791999ca68ee730f08
MD5 2925793dd1f7f2020d225235a2391342
BLAKE2b-256 2aaa12423cc3647fad561f5eb331b7a61e2ccb4c7633800a23c2a5d151e076e0

See more details on using hashes here.

File details

Details for the file validator_luhn-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: validator_luhn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for validator_luhn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd3d871b398de53b27417a86a21a399a5a8a2bf07caeea86f8cf7da3e4ebe3ff
MD5 4b7212d12a913ef25347e31719241e91
BLAKE2b-256 dda0caeda40636497c2b440e789f17492f0c3af9749e5ad98b7524f9b775f592

See more details on using hashes here.

Supported by

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