Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If
the same logic is truly needed for both instances, then they should be combined.
if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_thing() # Noncompliant; duplicates first condition
else:
do_the_rest()
b = 4 if a > 12 else 4
if (0 <= a < 10) or (20 <= a < 50):
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
else:
do_the_rest()
b = 4
or
if 0 <= a < 10:
do_the_thing()
elif 10 <= a < 20:
do_the_other_thing()
elif 20 <= a < 50:
do_the_third_thing()
else:
do_the_rest()
b = 8 if a > 12 else 4