You are viewing a single comment's thread. Return to all comments →
ChatGPT and passed all tests:
import re regex_integer_in_range = r"^[1-9][0-9]{5}$" regex_alternating_repetitive_digit_pair = r"(\d)(?=\d\1)" P = input() print(bool(re.match(regex_integer_in_range, P)) and len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2)
import re
regex_integer_in_range = r"^[1-9][0-9]{5}$" regex_alternating_repetitive_digit_pair = r"(\d)(?=\d\1)"
P = input()
print(bool(re.match(regex_integer_in_range, P)) and len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2)
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Postal Codes
You are viewing a single comment's thread. Return to all comments →
ChatGPT and passed all tests: