I have a functions in Python which has a series of if statements.
def some_func():
if condition_1:
return result_1
if condition_2:
return result_2
... #other if statements
But I want that the order of these if statements is changed every time I call the function.
Like if I call the function there can be a case when condition_1 and condition_2 both are true but since condition_1 is checked first thus I will get result_1 but I want that when I call the function second time some other random condition to be checked. (since I have only five if statements in the function therefore any one of the five conditions).
So is there any way to do this like storing the conditions in a list or something.
Any help will be appreciated.