An early return can settle a special case before you consider the ordinary rules. Combine conditions with and or or when either or both must hold.
def start_machine(powered, automatic, button):
if not powered:
return False
return automatic or button
print(start_machine(False, True, True)) # FalseThe early return handles a missing requirement. Only a powered machine reaches the second decision.
Complete may_enter(age, with_adult, closed). A closed gallery admits nobody. When open, anyone aged 12 or older may enter alone. Younger visitors need an adult. Return a boolean.