What I want to do is to have an function called from an array of function. I did my homework and came across this stackOverflow question. https://stackoverflow.com/questions/30549292/in-python-how-do-i-run-an-array-of-functions
However the code offered in it works for calling all the functions in the array in turn. What I would like to do is to call just one function in the array depending on the array index. What I would call in assembly terms "a vectored jump to a subroutine".
I am using Circuit Python on a RP2040
Here is the code:-
def one():
print("One")
def two():
print("Two")
def three():
print("Three")
arr = (one,two,three)
for fnc in arr:
fnc()
This runs through each function in turn
However what I would like to do is to call just one function depending on an array index. Something like "call function arr[i]