Finding whether Clockwise or Anti - clockwise path take minimum flip .
if ( valClockwise <= valAnticlockwise ) : NEW_LINE INDENT if ( isOpposite == False ) : NEW_LINE INDENT print ( " Clockwise " , valClockwise ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Anti - clockwise " , valAnticlockwise ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if ( isOpposite == False ) : NEW_LINE INDENT print ( " Anti - clockwise " , valAnticlockwise ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Clockwise " , valClockwise ) NEW_LINE DEDENT DEDENT