I have a section of code with several nested if statements that must be in a certain order. However, one of those ifs is optional. That is, if we do test condition1, we must do it first, but we can skip it if the user prefers. One can do this the following way:
option = True #user can toggle this
if option:
    if condition1:
        if condition2:
            if condition3:
                print("Hello World")
else:
     if condition2:
         if condition3:
            print("Hello World")
However, this reuses a lot of text. What is the best way to do this?
 
     
    