I have two functions,and their structure like that,
def extract(input):
pass #test the length of input, and the length changed over time
def checkif(s1):
r1 = extract(s1)
if len(r1) < 1:
r1 = extract(s1)
if len(r1) < 1:
r1 = extract(s1)
if len(r1) < 1:
r1 = extract(s1)
return r1
else:
return r1
else:
return r1
else:
return r1
I want to return a result that its length is larger than 1 and after 4 times, if it still less than 1, that is enough, then return the result that smaller than 1. You see, the function of checkif is complex and I think it can be reduced, but how to reduce this structure? Any idea is helpful!