Project #05: Building a Credit Card Number Validation Program | Python Coding for Beginners

preview_player
Показать описание
In this project, you'll use Luhn algorithm to validate credit card numers. This project looks simple but it involves many basic techniques and concepts: data types conversion, list and string manipulation, regular expressions, input validation... Hope it helps you improve your Python basic skill

For your convenience, I include some valid card numbers for you to input and see how your program works:
Amex
374245455400126
378282246310005

Discover
6011000991300009
6011111111111117
6011000990139424

JCB
3566000020000410
3530111333300000

Mastercard
5425233430109903

Visa
4263982640269299
4917484589897107

Diners Club
30569309025904
38520000023237

Visa: Card numbers start with a 4.
MasterCard: Card numbers start with the numbers 51 through 55.
Diners Club: Card numbers begin with 36 or 38. (There are Diners Club cards that begin with 5. These are a joint venture between Diners Club and MasterCard, and are processed like a MasterCard.)
Discover: Card numbers begin with 6011 or 65.
Japan Credit Bureau (JCB): Card numbers begin with 35.
American Express (Amex): Card numbers beginning with 34 or 37.

-------------------------
Python Coding for Beginners
Python Programming for Beginners
Learn Python by Building Projects
Python Exercises and Practical Examples with solutions
Practice Python Online with solution
How to write a Python program
Python Programming Data Structure and Algorithm
Python Problem Solving
Python Game Tutorial
Python Game Programming
Python Game Development
Python Tips and Tricks
Рекомендации по теме
Комментарии
Автор

For your convenience, I include some valid card numbers for you to input and see how your program works:
Amex:
374245455400126
378282246310005

Discover:
6011000991300009

6011000990139424

JCB:
3566000020000410


Mastercard:
5425233430109903

Visa:
4263982640269299
4917484589897107

Diners Club:
30569309025904

makeeverydayezday
Автор

I didn't know that each card provider has their own assigned prefix numbers. I am so glad I found this channel! Thanks a lot for your clear explanation!:)

lucatony
Автор

Dude, you just helped me to understand "Regular expressions" in Python that I've for long time. Catch my burning 👍👍👍 and loyal subscription.

JamesAdams-wczl
Автор

I wrote the same program last month but only used string methods, so the code was a bit long, with the use of regex like you show in this video, it's more efficient. Good job!

tsudashiro
Автор

Hello sir, by chance is this possible to be added on a database? Like using xampp mysql?

jstnngy
Автор

Hey mate, do you have any idea how relative the card number with the expiry date and CVV number? Is there any algorithm that check them altogether? Thanks

jess.t