I have the following function that check whether a regex input is legit:
import re
def isvalid_regex():
for _ in range(2):
try:
re.compile(input())
return True
except re.error:
return False
The problem here is that I don't get a double input as I would expect by range(2). The function returns me False or True and exits. I guess a function cannot repeat return statements for the number of times of a for loop in range(x) exists right ? My goal is to have a double input and a double True or False return. For example as output:
True
False