Skip to content

Commit 879ca6c

Browse files
authored
kept the easy to understand code
1 parent 6c1b748 commit 879ca6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

RegexandParsing/ValidatingCreditCardNumbers.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
length_16 = bool(re.match(r"^[4-6]\d{15}$", credit))
1818
length_19 = bool(re.match(r"^[4-6]\d{3}-\d{4}-\d{4}-\d{4}$", credit))
1919
consecutive = bool(re.findall(r"(?=(\d)\1\1\1)", credit_removed_hiphen))
20-
if (length_16 or length_19) and consecutive or not length_16 and not length_19:
20+
if length_16 == True or length_19 == True:
21+
if consecutive == True:
22+
valid = False
23+
else:
2124
valid = False
2225
if valid:
2326
print("Valid")

0 commit comments

Comments
 (0)