We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Validating Credit Card Numbers
Validating Credit Card Numbers
Sort by
recency
|
433 Discussions
|
Please Login in order to post a comment
import re a= r"^(?=[4-6])(?!.*(.)(-?\1){3})(\d{4}-?\d{4}-?\d{4}-?\d{4})$" for i in range(int(input())): if re.match(a,input()): print("Valid") else: print("Invalid")
I decided to do it without regex --