So I have a numeric value and on those two functions can be applied.
Lets say I have a number 8.
I want to take its square and then its log or first the log and then its square.
So my function looks something like this
def transform(value, transformation_list):
# value is int, transformation_list = ["log",square"] or ["square","log"]
# square function and log function
return transformed value
Now if the first argument of the transformation list is “square” and the second is “log”,
then it should first execute square and then log
But if the first function in that list is “log” and second ” square” then it should implement first log and then square.
I dont want if : else kinda thing as it will get ugly as i add more transformations
How should I design this.
Something like the following should work:
For example: