Created
May 22, 2022 12:19
-
-
Save kayac-chang/65be419cb2b1c81d48b3fd7d8852c907 to your computer and use it in GitHub Desktop.
check_credit_card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_amax(card_number): | |
return re.search(r"(?=\b.{15}\b)^(34|37)", card_number) | |
def is_master_card(card_number): | |
return re.search(r"(?=\b.{16}\b)^5[1..5]", card_number) | |
def is_visa(card_number): | |
return re.search(r"(?=\b.{13,16}\b)^4", card_number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment