I am new in Python script. I would like to be a bit pro in my code writing. Basically, I have a script that has a functionally and I would like to add new functionality.
my code looks a bit like:
const declaration
CONST1 = ....
CONST2 = ....
CONST3 = ....
CONST4 = ....
CONST5 = ....
CONST6 = ....
CONST7 = ....
function declaration
def f1:
....
def f2:
....
def f3:
....
def f5:
....
def f7:
....
def f8:
....
def f0:
....
first part
logic
logic
logic
logic
logic
logic
logic
logic
second part
.......
.......
I want to add new functionality down here, so that when the script runs with certain params, the first parts or second runs depending on params.
I know I could use if ... else to do this, but would like to know if there is a more professional way to do this. so that the code would be more maintainable and easy to add things. Can you please give me some advice?
control flowthis is a very broad question, depending on your data/size of application, you can use different approaches out of loads of possibilities: en.wikipedia.org/wiki/Control_flow