You are viewing a single comment's thread. Return to all comments →
import re N = int(input()) l = [] for i in range(N): s = input() l.append(s) for j in l: if re.fullmatch(r"^(?!.*(\d)(?:-?\1){3})([456][0-9]{3})-?([0-9]{4})-?([0-9]{4})-?([0-9]{4})",j): print('Valid') else: print("Invalid")
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Credit Card Numbers
You are viewing a single comment's thread. Return to all comments →