if
statement can be simplified PYL-R17031def for_check(match):
2 try:
3 if 1 <= int(match) <= 100:4 return True
5 else:
6 return False
The highlighted if
block can be refactored into a simplified statement, increasing its readability.
def simplifiable_if(arg, arg2):
if arg and not arg2:
var = True
else:
var = False
return var
def simplifiable_if(arg, arg2):
var = bool(arg and not arg2)
return var